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>
This commit is contained in:
committed by
Raphael Kubo da Costa
parent
b5a184ec2d
commit
9047d9b84e
@@ -701,6 +701,7 @@ qint64 QAlsaAudioInput::processedUSecs() const
|
|||||||
void QAlsaAudioInput::suspend()
|
void QAlsaAudioInput::suspend()
|
||||||
{
|
{
|
||||||
if(deviceState == QAudio::ActiveState||resuming) {
|
if(deviceState == QAudio::ActiveState||resuming) {
|
||||||
|
snd_pcm_drain(handle);
|
||||||
timer->stop();
|
timer->stop();
|
||||||
deviceState = QAudio::SuspendedState;
|
deviceState = QAudio::SuspendedState;
|
||||||
emit stateChanged(deviceState);
|
emit stateChanged(deviceState);
|
||||||
|
|||||||
@@ -673,6 +673,7 @@ QAudioFormat QAlsaAudioOutput::format() const
|
|||||||
void QAlsaAudioOutput::suspend()
|
void QAlsaAudioOutput::suspend()
|
||||||
{
|
{
|
||||||
if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState || resuming) {
|
if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState || resuming) {
|
||||||
|
snd_pcm_drain(handle);
|
||||||
timer->stop();
|
timer->stop();
|
||||||
deviceState = QAudio::SuspendedState;
|
deviceState = QAudio::SuspendedState;
|
||||||
errorState = QAudio::NoError;
|
errorState = QAudio::NoError;
|
||||||
|
|||||||
Reference in New Issue
Block a user