[audacious-plugins] - In pulse_flush() call pa_stream_cork() to pause playback quickly in order to avoid loud clicks/n

Michael Schwendt mschwendt at fedoraproject.org
Sat Aug 14 20:03:28 UTC 2010


commit 8813afab5dd32a97d3eab89e92547cd11956e5e3
Author: Michael Schwendt <mschwendt at fedoraproject.org>
Date:   Sat Aug 14 22:03:27 2010 +0200

    - In pulse_flush() call pa_stream_cork() to pause playback quickly in order
      to avoid loud clicks/noise when stopping/changing currently playing
      track. Afterwards restore previous 'corked' state again.
      Is this a Pulse Audio issue?

 audacious-plugins-2.4-pulse-flush.patch |   63 +++++++++++++++++++++++++++++++
 audacious-plugins.spec                  |   11 +++++-
 2 files changed, 73 insertions(+), 1 deletions(-)
---
diff --git a/audacious-plugins-2.4-pulse-flush.patch b/audacious-plugins-2.4-pulse-flush.patch
new file mode 100644
index 0000000..932193d
--- /dev/null
+++ b/audacious-plugins-2.4-pulse-flush.patch
@@ -0,0 +1,63 @@
+diff -Nur audacious-plugins-fedora-2.4-rc2-orig/src/pulse_audio/pulse_audio.c audacious-plugins-fedora-2.4-rc2/src/pulse_audio/pulse_audio.c
+--- audacious-plugins-fedora-2.4-rc2-orig/src/pulse_audio/pulse_audio.c	2010-08-13 23:01:13.000000000 +0200
++++ audacious-plugins-fedora-2.4-rc2/src/pulse_audio/pulse_audio.c	2010-08-14 21:59:14.000000000 +0200
+@@ -419,8 +419,9 @@
+ }
+ 
+ static void pulse_flush(int time) {
+-    pa_operation *o = NULL;
++    pa_operation *o = NULL, *o2 = NULL;
+     int success = 0;
++    gboolean corked;
+ 
+     CHECK_CONNECTED();
+ 
+@@ -429,12 +430,24 @@
+ 
+     written = time * (int64_t) bytes_per_second / 1000;
+ 
++    corked = pa_stream_is_corked(stream);
++	o2 = pa_stream_cork(stream, 1, stream_success_cb, &success);
++    if (!o2) {
++        goto fail;
++    }
++    while (pa_operation_get_state(o2) == PA_OPERATION_RUNNING) {
++        CHECK_DEAD_GOTO(fail, 1);
++        pa_threaded_mainloop_wait(mainloop);
++    }
++    pa_operation_unref(o2);
++    o2 = NULL;
++
+     if (!(o = pa_stream_flush(stream, stream_success_cb, &success))) {
+         AUDDBG("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context)));
+         goto fail;
+     }
+ 
+-    while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
++    while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) {
+         CHECK_DEAD_GOTO(fail, 1);
+         pa_threaded_mainloop_wait(mainloop);
+     }
+@@ -442,9 +455,22 @@
+     if (!success)
+         AUDDBG("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context)));
+ 
++    if (!corked) {
++        o2 = pa_stream_cork(stream, 0, stream_success_cb, &success);
++        if (!o2) {
++            goto fail;
++        }
++        while (pa_operation_get_state(o2) == PA_OPERATION_RUNNING) {
++            CHECK_DEAD_GOTO(fail, 1);
++            pa_threaded_mainloop_wait(mainloop);
++        }
++    }
++
+ fail:
+     if (o)
+         pa_operation_unref(o);
++    if (o2)
++        pa_operation_unref(o2);
+ 
+     pa_threaded_mainloop_unlock(mainloop);
+ }
diff --git a/audacious-plugins.spec b/audacious-plugins.spec
index 00b1d5d..87eca40 100644
--- a/audacious-plugins.spec
+++ b/audacious-plugins.spec
@@ -5,7 +5,7 @@
 
 Name: audacious-plugins
 Version: 2.4
-Release: 0.9.rc2%{?dist}
+Release: 0.10.rc2%{?dist}
 Summary: Plugins for the Audacious media player
 Group: Applications/Multimedia
 URL: http://audacious-media-player.org/
@@ -22,6 +22,8 @@ Source1: audacious-sid.desktop
 Patch0: audacious-plugins-2.0.1-xmms-skindir.patch
 # fix hardcoded libdir replacement
 Patch1: audacious-plugins-2.4-libdir.patch
+# AUDPLUG-280 (is this a Pulse Audio issue?)
+Patch2: audacious-plugins-2.4-pulse-flush.patch
 
 BuildRequires: audacious-devel >= %{aud_ver}
 BuildRequires: gettext
@@ -122,6 +124,7 @@ providers may build it with libsidplay 2.
 %setup -q -n audacious-plugins-fedora-%{version}-rc2
 %patch0 -p1 -b .xmms-skindir
 %patch1 -p1 -b .libdir
+%patch2 -p1 -b .pulse-flush
 
 for i in src/ladspa/ladspa.c
 do
@@ -209,6 +212,12 @@ update-desktop-database &> /dev/null || :
 
 
 %changelog
+* Sat Aug 14 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 2.4-0.10.rc2
+- In pulse_flush() call pa_stream_cork() to pause playback quickly in order
+  to avoid loud clicks/noise when stopping/changing currently playing
+  track. Afterwards restore previous 'corked' state again.
+  Is this a Pulse Audio issue?
+
 * Sat Aug 14 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 2.4-0.9.rc2
 - Update to rc2.
 


More information about the scm-commits mailing list