Accepting request 800950 from home:tiwai:branches:multimedia:libs

- Revert a problematic namehint change (boo#1171044)

- Backport upstream fixes:
  fixes for PCM rate plugin, draining fix, topology parameter parser
  fix, USB device name for UCM:
  0017-pcm-rate-fix-the-remaining-size-calculation-in-snd_p.patch
  0018-use-case.h-add-USB-as-allowed-device-name.patch
  0019-topology-Use-bool-parser-to-parse-boolean-value.patch
  0020-fix-infinite-draining-of-the-rate-plugin-in-SND_PCM_.patch
  0021-test-pcm_min-add-snd_pcm_drain-call-and-indentation-.patch

OBS-URL: https://build.opensuse.org/request/show/800950
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=273
This commit is contained in:
Takashi Iwai 2020-05-07 07:30:39 +00:00 committed by Git OBS Bridge
parent 4594d6ec9e
commit e3a7d78266
7 changed files with 277 additions and 0 deletions

View File

@ -0,0 +1,27 @@
From a43074ba17dd46878c7be447a50f9c4b5311929b Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Thu, 23 Apr 2020 13:43:32 +0200
Subject: [PATCH 17/21] pcm: rate - fix the remaining size calculation in
snd_pcm_rate_drain()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/pcm/pcm_rate.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
index fdcaa8de7382..21611f62c370 100644
--- a/src/pcm/pcm_rate.c
+++ b/src/pcm/pcm_rate.c
@@ -1060,6 +1060,8 @@ static int snd_pcm_rate_drain(snd_pcm_t *pcm)
snd_pcm_sw_params(rate->gen.slave, &sw_params);
size = rate->appl_ptr - rate->last_commit_ptr;
+ if (size > pcm->boundary)
+ size -= pcm->boundary;
ofs = rate->last_commit_ptr % pcm->buffer_size;
while (size > 0) {
snd_pcm_uframes_t psize, spsize;
--
2.16.4

View File

@ -0,0 +1,28 @@
From 4327660c7154344a0c6075d5a665a4e5b89fc78d Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 28 Apr 2020 12:58:41 +0200
Subject: [PATCH 18/21] use-case.h: add USB as allowed device name
Some USB devices are really generic where the
PCM stream can be routed to different paths.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
include/use-case.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/use-case.h b/include/use-case.h
index c2ba79a9fdb1..21df1de472d6 100644
--- a/include/use-case.h
+++ b/include/use-case.h
@@ -140,6 +140,7 @@ extern "C" {
#define SND_USE_CASE_DEV_EARPIECE "Earpiece" /**< Earpiece Device */
#define SND_USE_CASE_DEV_SPDIF "SPDIF" /**< SPDIF Device */
#define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI Device */
+#define SND_USE_CASE_DEV_USB "USB" /**< USB Device (multifunctional) */
/* add new devices to end of list */
--
2.16.4

View File

@ -0,0 +1,35 @@
From 496e239e65ecdab94358281b3b1346634a1476ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?=
<amadeuszx.slawinski@linux.intel.com>
Date: Fri, 17 Apr 2020 12:47:47 -0400
Subject: [PATCH 19/21] topology: Use bool parser to parse boolean value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It should be safe to change this as correct values with int would be 0
or 1 and bool parser handles them correctly.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/topology/dapm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/topology/dapm.c b/src/topology/dapm.c
index 70645126d0bc..cd1a87704681 100644
--- a/src/topology/dapm.c
+++ b/src/topology/dapm.c
@@ -595,7 +595,8 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg,
}
if (strcmp(id, "invert") == 0) {
- if (tplg_get_integer(n, &ival, 0))
+ ival = snd_config_get_bool(n);
+ if (ival < 0)
return -EINVAL;
widget->invert = ival;
--
2.16.4

View File

@ -0,0 +1,64 @@
From 29041c522071172af2c6bf086b3a0c19510a6660 Mon Sep 17 00:00:00 2001
From: "sylvain.bertrand@gmail.com" <sylvain.bertrand@gmail.com>
Date: Tue, 28 Apr 2020 12:09:18 +0000
Subject: [PATCH 20/21] fix infinite draining of the rate plugin in
SND_PCM_NONBLOCK mode
The draining function of the rate plugin does not handle properly the
SND_PCM_NONBLOCK case. It can write data to the slave plugin each time the
function is called, but does not update its internal state in order to
reach a stopping condition. Use a last_commit_ptr workaround to reach such
condition.
Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@legeek.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/pcm/pcm_rate.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
index 21611f62c370..4f99a95b325f 100644
--- a/src/pcm/pcm_rate.c
+++ b/src/pcm/pcm_rate.c
@@ -1051,6 +1051,7 @@ static int snd_pcm_rate_drain(snd_pcm_t *pcm)
/* commit the remaining fraction (if any) */
snd_pcm_uframes_t size, ofs, saved_avail_min;
snd_pcm_sw_params_t sw_params;
+ int commit_err;
__snd_pcm_lock(pcm);
/* temporarily set avail_min to one */
@@ -1079,14 +1080,29 @@ static int snd_pcm_rate_drain(snd_pcm_t *pcm)
if (! spsize)
break;
}
- snd_pcm_rate_commit_area(pcm, rate, ofs,
+ commit_err = snd_pcm_rate_commit_area(pcm, rate, ofs,
psize, spsize);
+ if (commit_err == 1) {
+ rate->last_commit_ptr += psize;
+ if (rate->last_commit_ptr >= pcm->boundary)
+ rate->last_commit_ptr = 0;
+ } else if (commit_err == 0) {
+ if (pcm->mode & SND_PCM_NONBLOCK != 0) {
+ commit_err = -EAGAIN;
+ break;
+ }
+ continue;
+ } else
+ break;
+
ofs = (ofs + psize) % pcm->buffer_size;
size -= psize;
}
sw_params.avail_min = saved_avail_min;
snd_pcm_sw_params(rate->gen.slave, &sw_params);
__snd_pcm_unlock(pcm);
+ if (commit_err < 0)
+ return commit_err;
}
return snd_pcm_drain(rate->gen.slave);
}
--
2.16.4

View File

@ -0,0 +1,93 @@
From 21e2fc3857b842e8b47f77da785248edbaa69f5f Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Sun, 3 May 2020 20:07:29 +0200
Subject: [PATCH 21/21] test: pcm_min - add snd_pcm_drain() call and
indentation fixes
Fixes: https://github.com/alsa-project/alsa-lib/issues/46
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
test/pcm_min.c | 50 ++++++++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 24 deletions(-)
diff --git a/test/pcm_min.c b/test/pcm_min.c
index 7462a45fef33..4c120b4c2b27 100644
--- a/test/pcm_min.c
+++ b/test/pcm_min.c
@@ -5,47 +5,49 @@
#include "../include/asoundlib.h"
static char *device = "default"; /* playback device */
-
-snd_output_t *output = NULL;
unsigned char buffer[16*1024]; /* some random data */
int main(void)
{
- int err;
- unsigned int i;
- snd_pcm_t *handle;
- snd_pcm_sframes_t frames;
+ int err;
+ unsigned int i;
+ snd_pcm_t *handle;
+ snd_pcm_sframes_t frames;
- for (i = 0; i < sizeof(buffer); i++)
- buffer[i] = random() & 0xff;
+ for (i = 0; i < sizeof(buffer); i++)
+ buffer[i] = random() & 0xff;
if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
printf("Playback open error: %s\n", snd_strerror(err));
exit(EXIT_FAILURE);
}
if ((err = snd_pcm_set_params(handle,
- SND_PCM_FORMAT_U8,
- SND_PCM_ACCESS_RW_INTERLEAVED,
- 1,
- 48000,
- 1,
- 500000)) < 0) { /* 0.5sec */
+ SND_PCM_FORMAT_U8,
+ SND_PCM_ACCESS_RW_INTERLEAVED,
+ 1,
+ 48000,
+ 1,
+ 500000)) < 0) { /* 0.5sec */
printf("Playback open error: %s\n", snd_strerror(err));
exit(EXIT_FAILURE);
}
for (i = 0; i < 16; i++) {
- frames = snd_pcm_writei(handle, buffer, sizeof(buffer));
- if (frames < 0)
- frames = snd_pcm_recover(handle, frames, 0);
- if (frames < 0) {
- printf("snd_pcm_writei failed: %s\n", snd_strerror(frames));
- break;
- }
- if (frames > 0 && frames < (long)sizeof(buffer))
- printf("Short write (expected %li, wrote %li)\n", (long)sizeof(buffer), frames);
- }
+ frames = snd_pcm_writei(handle, buffer, sizeof(buffer));
+ if (frames < 0)
+ frames = snd_pcm_recover(handle, frames, 0);
+ if (frames < 0) {
+ printf("snd_pcm_writei failed: %s\n", snd_strerror(frames));
+ break;
+ }
+ if (frames > 0 && frames < (long)sizeof(buffer))
+ printf("Short write (expected %li, wrote %li)\n", (long)sizeof(buffer), frames);
+ }
+ /* pass the remaining samples, otherwise they're dropped in close */
+ err = snd_pcm_drain(handle);
+ if (err < 0)
+ printf("snd_pcm_drain failed: %s\n", snd_strerror(err));
snd_pcm_close(handle);
return 0;
}
--
2.16.4

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Wed May 6 16:01:32 CEST 2020 - tiwai@suse.de
- Revert a problematic namehint change (boo#1171044)
-------------------------------------------------------------------
Wed May 6 12:16:00 CEST 2020 - tiwai@suse.de
- Backport upstream fixes:
fixes for PCM rate plugin, draining fix, topology parameter parser
fix, USB device name for UCM:
0017-pcm-rate-fix-the-remaining-size-calculation-in-snd_p.patch
0018-use-case.h-add-USB-as-allowed-device-name.patch
0019-topology-Use-bool-parser-to-parse-boolean-value.patch
0020-fix-infinite-draining-of-the-rate-plugin-in-SND_PCM_.patch
0021-test-pcm_min-add-snd_pcm_drain-call-and-indentation-.patch
-------------------------------------------------------------------
Mon Apr 20 17:55:24 CEST 2020 - tiwai@suse.de

View File

@ -64,6 +64,11 @@ Patch13: 0013-ucm-fix-the-device-remove-operation.patch
Patch14: 0014-ucm-fix-copy-n-paste-typo-RemoveDevice-list.patch
Patch15: 0015-pcm-dmix-fix-sw_params-handling-of-timestamp-types-i.patch
Patch16: 0016-conf-USB-Audio-Fix-S-PDIF-output-of-ASUS-Xonar-AE.patch
Patch17: 0017-pcm-rate-fix-the-remaining-size-calculation-in-snd_p.patch
Patch18: 0018-use-case.h-add-USB-as-allowed-device-name.patch
Patch19: 0019-topology-Use-bool-parser-to-parse-boolean-value.patch
Patch20: 0020-fix-infinite-draining-of-the-rate-plugin-in-SND_PCM_.patch
Patch21: 0021-test-pcm_min-add-snd_pcm_drain-call-and-indentation-.patch
# rest suse fixes
Patch101: alsa-lib-ignore-non-accessible-ALSA_CONFIG_PATH.patch
BuildRequires: doxygen
@ -157,13 +162,21 @@ This package contains the library for ALSA topology support.
%patch7 -p1
%patch8 -p1
%patch9 -p1
# causing a regression for capture streams on some apps (boo#1171044)
%if 0
%patch10 -p1
%endif
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch101 -p1
%build