Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.0
-
None
Description
It QAudioOutput::start() has been reported to crash while playing a file. This happen when the QIODevice is destructed after a call to QAudioOutput::start().
The documentation have a similar example :
{ QFile inputFile; inputFile.setFileName("/tmp/test.raw"); inputFile.open(QIODevice::ReadOnly); QAudioFormat format; // Set up the format, eg. format.setFrequency(8000); format.setChannels(1); format.setSampleSize(8); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::UnSignedInt); QAudioOutput *audio = new QAudioOutput(format, this); connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State))); audio->start(inputFile); }
Users copies this code inside a function, and the applications crashes when QFile is out of scope at the end of the function.
It would be nice to improve the documentation and/or to handle this case nicely when QIODevice::aboutToClose() is sent.