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

ok

OBS-URL: https://build.opensuse.org/request/show/59607
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-plugins?expand=0&rev=31
This commit is contained in:
2011-02-01 14:03:26 +00:00
committed by Git OBS Bridge
parent 9394afc0e9
commit 231c29c1b9
6 changed files with 13 additions and 177 deletions
+7
View File
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Jan 31 17:26:13 CET 2011 - tiwai@suse.de
- Updated to version 1.0.24:
* including previous fixes
* Fix documents
-------------------------------------------------------------------
Thu Sep 2 16:34:02 CEST 2010 - tiwai@suse.de
+3 -7
View File
@@ -1,5 +1,5 @@
#
# spec file for package alsa-plugins (Version 1.0.23)
# spec file for package alsa-plugins (Version 1.0.24)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -34,10 +34,10 @@ BuildRequires: libpulse-devel
%if %build_speex
BuildRequires: speex-devel
%endif
%define package_version 1.0.23
%define package_version 1.0.24
Url: http://www.alsa-project.org/
Summary: Extra Plug-Ins for the ALSA Library
Version: 1.0.23
Version: 1.0.24
Release: 4
License: LGPLv2.1+
Group: System/Libraries
@@ -49,8 +49,6 @@ Source: ftp://ftp.alsa-project.org/pub/plugins/alsa-plugins-%{package_ve
Source1: asound-pulse.conf
Source2: alsa-pulse.conf
Source3: baselibs.conf
Patch1: 0001-pulse-Fix-invalid-buffer-pointer-return-value.patch
Patch2: 0002-pulse-Add-handle_underrun-option.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -165,8 +163,6 @@ Authors:
%prep
%setup -q -n %{name}-%{package_version}
%patch1 -p1
%patch2 -p1
%build
export AUTOMAKE_JOBS=%{?jobs:%jobs}
@@ -1,78 +0,0 @@
From 1675414eca06dcfc20899adf104ace05acfe26a0 Mon Sep 17 00:00:00 2001
From: David Henningsson <diwic@ubuntu.com>
Date: Sat, 9 Jan 2010 09:09:14 +0100
Subject: [PATCH 1/2] pulse: Fix invalid buffer pointer return value
This patch improves recovering from underruns, and prevents hangs inside
snd_pcm_write* and snd_pcm_read* due to snd_pcm_avail* returning too
low values. It especially helps low latency situations.
Signed-off-by: David Henningsson <diwic@ubuntu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
pulse/pcm_pulse.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index 02a837e..b322898 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -90,6 +90,10 @@ static int update_ptr(snd_pcm_pulse_t *pcm)
if (pcm->io.stream == SND_PCM_STREAM_CAPTURE)
size -= pcm->offset;
+ /* Prevent accidental overrun of the fake ringbuffer */
+ if (size >= pcm->buffer_attr.tlength)
+ size = pcm->buffer_attr.tlength-1;
+
if (size > pcm->last_size) {
pcm->ptr += size - pcm->last_size;
pcm->ptr %= pcm->buffer_attr.tlength;
@@ -424,6 +428,7 @@ static snd_pcm_sframes_t pulse_write(snd_pcm_ioplug_t * io,
snd_pcm_pulse_t *pcm = io->private_data;
const char *buf;
snd_pcm_sframes_t ret = 0;
+ size_t writebytes;
assert(pcm);
@@ -445,13 +450,15 @@ static snd_pcm_sframes_t pulse_write(snd_pcm_ioplug_t * io,
(char *) areas->addr + (areas->first +
areas->step * offset) / 8;
- ret = pa_stream_write(pcm->stream, buf, size * pcm->frame_size, NULL, 0, 0);
+ writebytes = size * pcm->frame_size;
+ ret = pa_stream_write(pcm->stream, buf, writebytes, NULL, 0, 0);
if (ret < 0) {
ret = -EIO;
goto finish;
}
/* Make sure the buffer pointer is in sync */
+ pcm->last_size -= writebytes;
ret = update_ptr(pcm);
if (ret < 0)
goto finish;
@@ -528,6 +535,7 @@ static snd_pcm_sframes_t pulse_read(snd_pcm_ioplug_t * io,
dst_buf = (char *) dst_buf + frag_length;
remain_size -= frag_length;
+ pcm->last_size -= frag_length;
}
/* Make sure the buffer pointer is in sync */
@@ -730,6 +738,11 @@ static int pulse_prepare(snd_pcm_ioplug_t * io)
pcm->offset = 0;
pcm->underrun = 0;
+ /* Reset fake ringbuffer */
+ pcm->last_size = 0;
+ pcm->ptr = 0;
+ update_ptr(pcm);
+
finish:
pa_threaded_mainloop_unlock(pcm->p->mainloop);
--
1.7.2.1
@@ -1,89 +0,0 @@
From c20d516e229620129ee20175d8fee8511cc3a4bd Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 9 Jul 2010 14:05:03 +0200
Subject: [PATCH 2/2] pulse: Add handle_underrun option
Added a config option "handle_underrun" to specify whether pulse plugin
handles the underrun reported from PA. The default value is now set to
false, i.e. it will ignore underruns in PA (for good reasons below).
You can take back to the old behavior by setting handle_underrun true.
The original idea was brought by David Henningsson <diwic@ubuntu.com>,
while this patch is simplified and makes the behavior configurable.
The reasons for avoiding underruns (cited from David's original patch):
Reporting underruns to ALSA seems to do more bad than good, for these reasons:
* If pulseaudio gets an underrun, the normal way to end that underrun is to
feed it with more buffers. This is different from the ALSA way of dealing
with underruns, which requires hardware buffer pointers to be reset.
* In addition, underrun signals are delivered asynchronously from pulseaudio.
This means that there might be more buffers on the way to pulseaudio when
the underrun is reported, making the underrun obsolete. Unfortunately,
there is currently no known way to determine whether this is the case or
not.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
pulse/pcm_pulse.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index b322898..2df0a80 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -39,6 +39,7 @@ typedef struct snd_pcm_pulse {
size_t last_size;
size_t ptr;
int underrun;
+ int handle_underrun;
size_t offset;
@@ -696,8 +697,9 @@ static int pulse_prepare(snd_pcm_ioplug_t * io)
if (io->stream == SND_PCM_STREAM_PLAYBACK) {
pa_stream_set_write_callback(pcm->stream,
stream_request_cb, pcm);
- pa_stream_set_underflow_callback(pcm->stream,
- stream_underrun_cb, pcm);
+ if (pcm->handle_underrun)
+ pa_stream_set_underflow_callback(pcm->stream,
+ stream_underrun_cb, pcm);
r = pa_stream_connect_playback(pcm->stream, pcm->device,
&pcm->buffer_attr,
PA_STREAM_AUTO_TIMING_UPDATE |
@@ -980,6 +982,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pulse)
snd_config_iterator_t i, next;
const char *server = NULL;
const char *device = NULL;
+ int handle_underrun = 0;
int err;
snd_pcm_pulse_t *pcm;
@@ -1005,6 +1008,14 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pulse)
}
continue;
}
+ if (strcmp(id, "handle_underrun") == 0) {
+ if ((err = snd_config_get_bool(n)) < 0) {
+ SNDERR("Invalid value for %s", id);
+ return -EINVAL;
+ }
+ handle_underrun = err;
+ continue;
+ }
SNDERR("Unknown field %s", id);
return -EINVAL;
}
@@ -1028,6 +1039,8 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pulse)
goto error;
}
+ pcm->handle_underrun = handle_underrun;
+
err = pulse_connect(pcm->p, server);
if (err < 0)
goto error;
--
1.7.2.1
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5c1b2791ad33ef01f0f4f040004c931310da05e45aaa8d4146024c586f2b3183
size 326504
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fa8e12eb2dfeac083f117c03b3708a017531426ba542a8a729e4801d37861263
size 329502