PDA

View Full Version : QAudioRecorder get stuck in states



33333
6th January 2017, 13:49
Hi,

Using QAudioRecorder (which extends QMediaRecorder), I want to use this flow of events over and over an arbitrary number of times:

set out file
record
stop recording

QMediaRecorder has a number "statuses" - https://doc.qt.io/qt-5/qmediarecorder.html#status. It also has three "states" but I've found the "states" and not the actual state but what state QMediaRecorder intends to get to. Anyway, the when I try to record then stop a QMediaRecorder it tends to get stuck in certain statuses and I can't make it get out of the status (expect by killing the process). It seems to get stuck in FinalizingStatus and StartingStatus.

Any ideas of how I can fix this??

Thanks,

33333

33333
7th January 2017, 00:23
After messing around a bit I found a solution that works: Use heap allocated QAudioRecorder, delete and start a new one with each new recording. Don't try to stop the QAudioRecorder before deleting it either - I found that can hang indefinitely on occasion for reasons I have not definitively determined.

Not sure why this works, must be something in the destructor? I also found that things would freeze up using the default device "default:". Instead I'm using the full name of the ALSA device "alsa:hw:CARD=PCH,DEV=0". I thought the default device was a pseudonym for this but obviously not - weird confusing ALSA crap...