- Backport upstream fix patches, including the deadlock fix for aplay/arecord (boo#1031525): 0001-ucm-Add-ATTRIBUTE_UNUSED-for-unused-parameters-of-ex.patch 0002-ucm-parser-needs-limits.h.patch 0003-pcm-direct-allow-users-to-configure-different-period.patch 0004-pcm-dshare-enable-silence.patch 0005-pcm-rate-fix-the-hw_ptr-update-until-the-boundary-av.patch 0006-plugin-dynamically-update-avail_min-on-slave.patch 0007-rate-dynamic-update-avail_min-on-slave.patch 0008-topology-fix-unused-const-variable-warning.patch 0009-seq-improve-documentation-about-new-get-pid-card-fun.patch 0010-pcm-direct-returning-semop-error-code-for-semaphore-.patch 0011-pcm-direct-Fix-for-sync-issue-on-xrun-recover.patch 0012-pcm-direct-check-state-before-enter-poll-on-timer.patch 0013-pcm-direct-don-t-return-bogus-buffer-levels-in-xrun-.patch 0014-conf-ucm-broxton-add-broxton-rt298-conf-files.patch 0015-pcm-direct-Fix-deadlock-in-poll_descriptors.patch 0016-ucm-Assure-the-user-input-card-name-not-to-exceed-ma.patch 0017-ucm-Load-device-specific-configuration-file-based-on.patch 0018-ucm-Add-command-get-_file-to-get-the-config-file-nam.patch 0019-topology-Fix-incorrect-license-in-source-comments.patch 0020-conf-cards-add-support-for-pistachio-card.patch 0021-pcm-multi-Drop-the-fixed-slave_map-in-snd_pcm_multi_.patch 0022-conf-Add-card-config-for-Intel-HDMI-DP-LPE-audio.patch 0023-pcm-Avoid-lock-for-snd_pcm_nonblock.patch 0024-pcm-Disable-locking-in-async-mode.patch 0025-pcm-dmix-Allow-disabling-x86-optimizations.patch 0026-pcm-dmix_rewind-corrupts-application-pointer-fix.patch 0027-pcm-direct-fix-race-on-clearing-timer-events.patch 0028-pcm-file-Enable-file-writing-for-capture-path.patch OBS-URL: https://build.opensuse.org/request/show/483406 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=210
69 lines
1.9 KiB
Diff
69 lines
1.9 KiB
Diff
From fdc898d41135b26772d0fffe07e9eb0de6597125 Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Kysela <perex@perex.cz>
|
|
Date: Mon, 20 Mar 2017 08:34:33 +0100
|
|
Subject: [PATCH 38/43] dmix plugin: fix drain for nonblock mode
|
|
|
|
---
|
|
src/pcm/pcm_dmix.c | 24 ++++++++++++++++--------
|
|
1 file changed, 16 insertions(+), 8 deletions(-)
|
|
|
|
--- a/src/pcm/pcm_dmix.c
|
|
+++ b/src/pcm/pcm_dmix.c
|
|
@@ -628,7 +628,7 @@ static int __snd_pcm_dmix_drain(snd_pcm_
|
|
{
|
|
snd_pcm_direct_t *dmix = pcm->private_data;
|
|
snd_pcm_uframes_t stop_threshold;
|
|
- int err;
|
|
+ int err = 0;
|
|
|
|
switch (snd_pcm_state(dmix->spcm)) {
|
|
case SND_PCM_STATE_SUSPENDED:
|
|
@@ -639,8 +639,6 @@ static int __snd_pcm_dmix_drain(snd_pcm_
|
|
|
|
if (dmix->state == SND_PCM_STATE_OPEN)
|
|
return -EBADFD;
|
|
- if (pcm->mode & SND_PCM_NONBLOCK)
|
|
- return -EAGAIN;
|
|
if (dmix->state == SND_PCM_STATE_PREPARED) {
|
|
if (snd_pcm_mmap_playback_hw_avail(pcm) > 0)
|
|
snd_pcm_dmix_start(pcm);
|
|
@@ -663,23 +661,33 @@ static int __snd_pcm_dmix_drain(snd_pcm_
|
|
err = snd_pcm_dmix_sync_ptr(pcm);
|
|
if (err < 0) {
|
|
snd_pcm_dmix_drop(pcm);
|
|
- return err;
|
|
+ goto done;
|
|
}
|
|
if (dmix->state == SND_PCM_STATE_DRAINING) {
|
|
snd_pcm_dmix_sync_area(pcm);
|
|
- snd_pcm_wait_nocheck(pcm, -1);
|
|
- snd_pcm_direct_clear_timer_queue(dmix); /* force poll to wait */
|
|
+ if ((pcm->mode & SND_PCM_NONBLOCK) == 0) {
|
|
+ snd_pcm_wait_nocheck(pcm, -1);
|
|
+ snd_pcm_direct_clear_timer_queue(dmix); /* force poll to wait */
|
|
+ }
|
|
|
|
switch (snd_pcm_state(dmix->spcm)) {
|
|
case SND_PCM_STATE_SUSPENDED:
|
|
- return -ESTRPIPE;
|
|
+ err = -ESTRPIPE;
|
|
+ goto done;
|
|
+ case SND_PCM_STATE_DRAINING:
|
|
+ if (pcm->mode & SND_PCM_NONBLOCK) {
|
|
+ err = -EAGAIN;
|
|
+ goto done;
|
|
+ }
|
|
+ break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
} while (dmix->state == SND_PCM_STATE_DRAINING);
|
|
+done:
|
|
pcm->stop_threshold = stop_threshold;
|
|
- return 0;
|
|
+ return err;
|
|
}
|
|
|
|
static int snd_pcm_dmix_drain(snd_pcm_t *pcm)
|