- Backport various upstream fixes for PCM (bnc#979702): 0001-pcm_plugin-fix-appl-pointer-not-correct-when-mmap_co.patch 0002-pcm-Clean-up-error-paths-in-snd_pcm_plugin_-helpers.patch 0003-pcm-Fallback-open-as-the-first-instance-for-dmix-co.patch 0004-pcm-softvol-fix-conversion-of-TLVs-min_db-and-max_dB.patch 0005-pcm-Fix-suspend-resume-regression-with-dmix-co.patch 0006-pcm-dmix-Fix-doubly-resume-of-slave-PCM.patch OBS-URL: https://build.opensuse.org/request/show/395038 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=196
49 lines
1.6 KiB
Diff
49 lines
1.6 KiB
Diff
From 5610b356b5f110f7f8e586f56e5b74e0f0c2db38 Mon Sep 17 00:00:00 2001
|
|
From: Takashi Iwai <tiwai@suse.de>
|
|
Date: Wed, 11 May 2016 13:06:25 +0200
|
|
Subject: [PATCH] pcm: dmix: Fix doubly resume of slave PCM
|
|
|
|
The dmix plugin and co may trigger the resume for each instance in
|
|
snd_pcm_direct_resume(). It means that the slave PCM gets resumed or
|
|
re-prepared/started by each opened dmix stream, and this may end up
|
|
with the doubly triggers even though the slave PCM has been already
|
|
resumed by another dmix stream.
|
|
|
|
For avoiding this conflicts, check the slave PCM state and resume only
|
|
when it's still in the suspended state. Meanwhile we keep the shadow
|
|
state updated no matter whether the slave was triggered or not.
|
|
|
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
---
|
|
src/pcm/pcm_direct.c | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
|
|
index e28738b0de96..ac082f1a73b2 100644
|
|
--- a/src/pcm/pcm_direct.c
|
|
+++ b/src/pcm/pcm_direct.c
|
|
@@ -841,6 +841,12 @@ int snd_pcm_direct_resume(snd_pcm_t *pcm)
|
|
int err;
|
|
|
|
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
|
|
+ /* resume only when the slave PCM is still in suspended state */
|
|
+ if (snd_pcm_state(dmix->spcm) != SND_PCM_STATE_SUSPENDED) {
|
|
+ err = 0;
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
err = snd_pcm_resume(dmix->spcm);
|
|
if (err == -ENOSYS) {
|
|
/* FIXME: error handling? */
|
|
@@ -848,6 +854,7 @@ int snd_pcm_direct_resume(snd_pcm_t *pcm)
|
|
snd_pcm_start(dmix->spcm);
|
|
err = 0;
|
|
}
|
|
+ out:
|
|
dmix->state = snd_pcm_state(dmix->spcm);
|
|
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
|
|
return err;
|
|
--
|
|
2.8.2
|
|
|