Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.3.2, 6.4, 6.5
-
None
-
-
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
- relates to
-
QTBUG-106885 On Ubuntu 22.04 the microphone device is captured before recording starts
- Closed