From bc42a549a309603ab4afe28b87406a663702aa24 Mon Sep 17 00:00:00 2001 From: Cheng Sun Date: Wed, 20 Nov 2019 11:23:09 +0000 Subject: QAlsaAudioOutput: leave IdleState as soon as there is data in the source This fixes two bugs: - Once IdleState is entered (due to underflow), one would have to bring the state to ActiveState manually before the backend would start sending new data to ALSA. This behavior is unlike that of QPulseAudioOutput, for example, which will automatically transition out of IdleState once there is data present in the source device. - Whilst in IdleState the audio output would would mark bytes as being consumed from the source device, even though they were not actually being sent to ALSA. Change-Id: If5b4835df0f58b7b15f1800d3a0a1041f1ab845a Reviewed-by: VaL Doroshchuk --- src/plugins/alsa/qalsaaudiooutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/alsa/qalsaaudiooutput.cpp') diff --git a/src/plugins/alsa/qalsaaudiooutput.cpp b/src/plugins/alsa/qalsaaudiooutput.cpp index 5c8ae171c..ee5aee989 100644 --- a/src/plugins/alsa/qalsaaudiooutput.cpp +++ b/src/plugins/alsa/qalsaaudiooutput.cpp @@ -707,7 +707,7 @@ bool QAlsaAudioOutput::deviceReady() if(l > 0) { // Got some data to output - if(deviceState != QAudio::ActiveState) + if (deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) return true; qint64 bytesWritten = write(audioBuffer,l); if (bytesWritten != l) -- cgit v1.2.3