Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.9
-
None
-
-
Multimedia wk 47-48, Multimedia wk 49-50, Multimedia wk 51-2
Description
The problem is reproduced for Darwin and ffmpeg audio backends.
QAudioDevice is not updated after calling QAudioInput::setDevice().
Let's say there are headphones with a microphone connected to a 3.5mm audio jack.
When QAudioDevice is first installed (the QAudioDevice object is obtained from calling QMediaDevices::audioInputs()) via the QAudioInput::setDevice() method, this happens correctly. However, if you start recording (QMediaRecorder::record()) and then stop it (QMediaRecorder::stop()), then disconnect the headphones and reconnect them to the jack, and then install the same audio device again via the QAudioInput::setDevice() method (the QAudioDevice object is obtained from calling QMediaDevices::audioInputs()), then further recording from this device will not work. However, if you Set another device via QAudioInput::setDevice() and then the first device again or instead recreate QAudioInput, then the recording will be correct again.
To demonstrate this behavior, I am attaching a project. You need to do the following:
Connect headphones with a microphone to the 3.5mm audio jack.
Run the attached project.
Select the connected microphone.
Click Start.
Make sure that reading from the microphone has started by the bytes output to the console.
Click Stop.
Disconnect the headphones with a microphone from the 3.5mm jack.
Connect them back.
Select the same microphone again.
Click Start.
Make sure that recording is not in progress, since the read bytes will not be output to the console.
Solution 0: stop recording from the current microphone with the Stop button, install another microphone, start and stop recording. Then select the original microphone again.
Solution 1: recreate the QAudioInput object before starting recording.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-130968 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
602938,13 | QAudioDevice: A Deeper Comparison of the Private Part | dev | qt/qtmultimedia | Status: NEW | 0 | 0 |