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

QMediaRecorder does not start recording on darwin backend

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 6.7.1, 6.7.2
    • Multimedia
    • None
    • macOS
    • Multimedia wk 31-32, Multimedia wk 35-38

    Description

      QMediaRecorder does not start recording on darwin backend

      Mac mini intel core i5, MacOS Sonoma 14.5

      When using the darwin backend (via the environment variable QT_MEDIA_BACKEND=darwin), the QMediaRecorder::recorderStateChanged signal does not emit with the QMediaRecorder::RecordingState state, but no errors occur:

      "Logitech Webcam C920-C"
      Qt::PermissionStatus::Granted
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      on_pushRecord_clicked() QMediaRecorder::NoError "" 

      I am attaching a minimal project for reproduction and result of test_audio_config utility.

      Update 0

      The problem is caused by the fact that the number of audio channels is not specified before recording starts, and the same problem occurs when explicitly called before recording starts:

      audioRecorder->setAudioChannelCount(-1);
      // (this call assumes that the number of channels will be selected automatically). 

      When explicitly specifying, for example, two channels:

      audioRecorder->setAudioChannelCount(2); 

      recording starts i.e. The QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState signal is emitted.

      However, another problem arises. One recording cycle is successful, but if you then start recording again, the following will happen. Immediately after the QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState signal, I catch the QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (-12737)" signal and then the QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState signal. And this concludes the recording.

      Here's the relevant output:

      "Logitech Webcam C920-C"
      Qt::PermissionStatus::Granted
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState
      on_pushRecord_clicked() QMediaRecorder::NoError ""
      QMediaRecorder::recorderStateChanged() QMediaRecorder::RecordingState
      QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (-12737)"
      QMediaRecorder::recorderStateChanged() QMediaRecorder::StoppedState 

      Update 1

      If I set audio input before each staring of recording and remove after each ending of recording then I get specified problem (QMediaRecorder::errorOccurred() QMediaRecorder::FormatError "An unknown error occurred (-12737)"):

       

      captureSession.setAudioInput(new QAudioInput(this));
      //...
      audioRecorder->record();
      
      // ...
      void onRecorderStateChanged(QMediaRecorder::RecorderState state)
      //...
          case QMediaRecorder::StoppedState:
              captureSession.setAudioInput({});

       

       

      But if I set audio input once before first starting of recording then the problem is gone.

      When I use QT_MEDIA_BACKEND=ffmpeg the problem doesn't observed no matter when the audio input is set.

      I attach source code for each case.

      Attachments

        Issue Links

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

          Activity

            People

              tpochep Timur Pocheptsov
              rumgot rumgot
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes