Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-131682

[linux] QAudioSource reads 4-channel data as 2-channel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P2: Important
    • None
    • 6.2.8
    • Multimedia
    • Linux/Other display system
    • Multimedia Next Next

    Description

      OS: Ubuntu 22.04

       

      Description: When you try to read quad channel audio data from the input device with QAudioSource, it will always read as if the number of channels is defined as 2.

      Here is CE:

       

      void ReadAudioThread::readQuadAudioData()
      {
          m_inputBuffer.setBuffer(nullptr);
          m_inputBuffer.open(QIODevice::WriteOnly | QIODevice::Truncate);
      
          QAudioFormat format;
          format.setSampleRate(m_defaultSampleRate);
          format.setChannelCount(m_quadNumChannels); // defined as 4
          format.setSampleFormat(QAudioFormat::Int16);
      
          QAudioDevice inputDevice = getInputAudioDevice();
          m_audio = new QAudioSource(inputDevice, format);
          connect(m_audio, &QAudioSource::stateChanged, this, &ReadAudioThread::handleStateChanged);
          createRecordingFile();
          m_timer = std::make_shared<QTimer>();
          m_timer->setInterval(200); // 200 msec.
          m_timer->callOnTimeout(this, &ReadAudioThread::reportReadProgress);
          m_audio->start(&m_inputBuffer); 
          ...
      }

      Even when the channels number is explicitly specified as 4 in the format.setChannelCount(), data for channels 3 and 4 repeats data for channels 1 and 2 in the {}m_inputBuffer

      P.S. Format is supported by the device

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtmultimediateam Qt Multimedia Team
            androsiuk Makym Androsiuk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes