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

QMediaRecorder frequently returns unknown errors when trying to record on Mac

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.2.8, 6.4.3, 6.5.0, 6.6.0
    • 6.3.2, 6.4, 6.5
    • Multimedia
    • None
    • macOS
    • a40b9fed5 (dev), b0332afbf (6.5), b442e7159 (6.4), a84280c74 (tqtc/lts-6.2)

    Description

      QMediaRecorder frequently returns unknown errors when trying to record on Mac

       

      I have a simple project (based on Qt examples) that uses the Qt Multimedia module to record audio from a microphone:

      audiorecorder.cpp:

      #include "audiorecorder.h"
      #include "ui_audiorecorder.h"
      
      #include <QAudioInput>
      #include <QMediaDevices>
      
      AudioRecorder::AudioRecorder()
          : ui(new Ui::AudioRecorder)
          , audioRecorder(new QMediaRecorder)
          , audioDevice(QMediaDevices::defaultAudioInput())
      {
          qDebug() << audioDevice.description();
      
          ui->setupUi(this);
      
          captureSession.setRecorder(audioRecorder);
      
      // If you set input and device here, then no errors occur
      //    captureSession.setAudioInput(new QAudioInput(this));
      //    captureSession.audioInput()->setDevice(audioDevice);
      
          connect(audioRecorder, &QMediaRecorder::recorderStateChanged, this,
                  [this] (QMediaRecorder::RecorderState state) {
              qDebug() << "QMediaRecorder::recorderStateChanged()" << state;
      
              switch (state) {
              case QMediaRecorder::RecordingState:
                  ui->pushRecord->setChecked(true);
                  break;
              case QMediaRecorder::PausedState:
                  break;
              case QMediaRecorder::StoppedState:
                  ui->pushRecord->setChecked(false);
      
                  captureSession.setAudioInput({});
      
                  break;
              }
      
          });
      
          connect(audioRecorder, &QMediaRecorder::errorOccurred, this,
                  [this](QMediaRecorder::Error error, const QString &errorString) {
              qDebug() << "QMediaRecorder::errorOccurred()" << error << errorString;
          });
      }
      
      void AudioRecorder::on_pushRecord_clicked() {
          if (ui->pushRecord->isChecked()) {
              captureSession.setAudioInput(new QAudioInput(this));
              captureSession.audioInput()->setDevice(audioDevice);
              audioRecorder->record();
          } else {
              audioRecorder->stop();
          }
      }

      The whole project is in the attached archive.

      If I run the project with a connected webcam and start recording several times and then stop it, I get the following output with errors:

      "Unknown USB Audio Device"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (1768846202)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (1768846202)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (1768846202)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (1768846202)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (1768846202)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (1768846202)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (1768846202)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState

      If I run the project without a connected webcam and start recording several times and then stop it, I get the following output with errors:

      "ZoomAudioDevice"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (-12737)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (-12737)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (-12737)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (-12737)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState

      Attachments

        Issue Links

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

          Activity

            People

              dorisverria Doris Verria
              rumgot rumgot
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews