Uploaded image for project: 'Qt Mobility'
  1. Qt Mobility
  2. QTMOBILITY-765

QAudioDeviceInfo::isFormatSupported and QAudioDeviceInfo::nearestFormat work incorrectly in Qt 4.7.0/4.7.1 Multimedia for Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 1.1.0
    • 1.1.0
    • Multimedia
    • None
    • Windows XP/7
    • dd619af2efd1136606777a2fa936fb64a54f24a3

    Description

      QAudioDeviceInfo::isFormatSupported and QAudioDeviceInfo::nearestFormat methods work incorrectly in Qt 4.7.0/4.7.1 Multimedia for Windows. Both these do not verify correctly settings for sample type, sample size, byte order, and sample rate in the input format. QAudioDeviceInfo::isFormatSupported returns true even if settings for these parameters are not supported by the audio system. QAudioDeviceInfo::nearestFormat returns the output format with these unsupported settings. In the result, when we create QAudioOutput by using the format with unsupported settings this does not work.
      These methods worked correctly in Qt 4.6.2.

      As I can see the problem is in QAudioDeviceInfoInternal::testSettings() (qaudiodeviceinfo_win32-P.cpp, Qt 4.7.0/4.7.1)

      bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
      {
      // Set nearest to closest settings that do work.
      // See if what is in settings will work (return value).

      bool failed = false;
      bool match = false;

      // check codec
      for( int i = 0; i < codecz.count(); i++)

      { if (format.codec() == codecz.at(i)) match = true; }

      if (!match) failed = true;

      // check channel
      match = false;
      if (!failed) {
      for( int i = 0; i < channelz.count(); i++) {
      if (format.channels() == channelz.at)

      { match = true; break; }
      }
      }
      if (!match) failed = true;

      // check frequency
      match = false;
      if (!failed) {
      for( int i = 0; i < freqz.count(); i++) {
      if (format.frequency() == freqz.at) { match = true; break; }

      }
      }

      // check sample size
      match = false;
      if (!failed) {
      for( int i = 0; i < sizez.count(); i++) {
      if (format.sampleSize() == sizez.at)

      { match = true; break; }
      }
      }

      // check byte order
      match = false;
      if (!failed) {
      for( int i = 0; i < byteOrderz.count(); i++) {
      if (format.byteOrder() == byteOrderz.at) { match = true; break; }

      }
      }

      // check sample type
      match = false;
      if (!failed) {
      for( int i = 0; i < typez.count(); i++) {
      if (format.sampleType() == typez.at)

      { match = true; break; }

      }
      }

      if(!failed)

      { // settings work return true; }

      return false;
      }

      The 'failed' flag is not set to 'true' as it needs after checking frequency, sample size, byte order, and sample type when these settings are not supported by audio system (are not present in appropriate lists).

      Attachments

        Activity

          People

            ling.hu@nokia.com Ling Hu (closed Nokia identity) (Inactive)
            alexander Alexander Kuzin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: