diff options
author | Cheng Sun <chengsun9@gmail.com> | 2019-11-20 11:23:09 +0000 |
---|---|---|
committer | Cheng Sun <chengsun9@gmail.com> | 2020-03-06 09:45:00 +0000 |
commit | bc42a549a309603ab4afe28b87406a663702aa24 (patch) | |
tree | 21bf85306eafb7faae49b834d4c3451cff35af97 | |
parent | 6e21318ca9748e6ddaf9f38052b7896e63ebb81f (diff) |
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 <valentyn.doroshchuk@qt.io>
-rw-r--r-- | src/plugins/alsa/qalsaaudiooutput.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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) |