diff options
author | Stephen Hurd <shurd@freebsd.org> | 2016-04-14 19:11:01 -0700 |
---|---|---|
committer | Raphael Kubo da Costa <rakuco@FreeBSD.org> | 2016-04-15 15:06:38 +0000 |
commit | 9047d9b84e9d94d193e77abd81f5980eff77d73a (patch) | |
tree | 1e37f6223ad20e7e994361bb96f3d9cf7562e7d3 /src | |
parent | b5a184ec2da2c17d2a6d03b416130bf300614664 (diff) |
ALSA: Call snd_pcm_drain() on suspend
The ALSA plugin previously didn't suspend the ALSA device when the
::suspend() method is called. This results in underrun errors when
it's resumed.
In ALSA, stopping a pcm doesn't close it, so the ALSA stop/start
functions map to the QAudioInput suspend/resume functions.
Change-Id: I2507065a1b7472af29eef70c531b9f6e8e5b3072
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/alsa/qalsaaudioinput.cpp | 1 | ||||
-rw-r--r-- | src/plugins/alsa/qalsaaudiooutput.cpp | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/alsa/qalsaaudioinput.cpp b/src/plugins/alsa/qalsaaudioinput.cpp index d9c775148..5f7a788a6 100644 --- a/src/plugins/alsa/qalsaaudioinput.cpp +++ b/src/plugins/alsa/qalsaaudioinput.cpp @@ -701,6 +701,7 @@ qint64 QAlsaAudioInput::processedUSecs() const void QAlsaAudioInput::suspend() { if(deviceState == QAudio::ActiveState||resuming) { + snd_pcm_drain(handle); timer->stop(); deviceState = QAudio::SuspendedState; emit stateChanged(deviceState); diff --git a/src/plugins/alsa/qalsaaudiooutput.cpp b/src/plugins/alsa/qalsaaudiooutput.cpp index 5702cfc78..02681a4df 100644 --- a/src/plugins/alsa/qalsaaudiooutput.cpp +++ b/src/plugins/alsa/qalsaaudiooutput.cpp @@ -673,6 +673,7 @@ QAudioFormat QAlsaAudioOutput::format() const void QAlsaAudioOutput::suspend() { if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState || resuming) { + snd_pcm_drain(handle); timer->stop(); deviceState = QAudio::SuspendedState; errorState = QAudio::NoError; |