[vorbis-tools] 01/01: Fix ogg123 freeze when interrupting at End-Of-Stream.

Martin Steghöfer martin.steghoefer-guest at moszumanska.debian.org
Wed Oct 29 17:21:49 UTC 2014


This is an automated email from the git hooks/post-receive script.

martin.steghoefer-guest pushed a commit to branch master
in repository vorbis-tools.

commit c1bad216e679801286659604c403e037c783aea8
Author: Martin Steghöfer <martin at steghoefer.eu>
Date:   Tue Oct 28 23:09:14 2014 +0100

    Fix ogg123 freeze when interrupting at End-Of-Stream.
    
    Closes: #307325
---
 ...freeze-when-interrupting-at-End-Of-Stream.patch | 76 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 77 insertions(+)

diff --git a/debian/patches/0007-Fix-ogg123-freeze-when-interrupting-at-End-Of-Stream.patch b/debian/patches/0007-Fix-ogg123-freeze-when-interrupting-at-End-Of-Stream.patch
new file mode 100644
index 0000000..482f2a2
--- /dev/null
+++ b/debian/patches/0007-Fix-ogg123-freeze-when-interrupting-at-End-Of-Stream.patch
@@ -0,0 +1,76 @@
+From: =?utf-8?q?Martin_Stegh=C3=B6fer?= <martin at steghoefer.eu>
+Date: Tue, 28 Oct 2014 23:04:19 +0100
+Subject: Fix ogg123 freeze when interrupting at End-Of-Stream.
+
+Bug-Debian: https://bugs.debian.org/307325
+
+When arriving at the end of the input file, the main thread waits for
+the output thread to finish up the current buffer. If a cancellation
+signal arrives at that stage, this signal of an empty buffer never
+arrives because the output thread bails out before actually emptying
+the buffer.
+
+Fix:
+1.) Make sure the output thread wakes up the main thread when bailing
+out, so the main thread can go on, too.
+2.) When the main thread wakes up while waiting for an empty buffer,
+make sure it understands the situation (that there won't be an empty
+buffer because the replay has been cancelled) and doesn't go back to
+sleep.
+---
+ ogg123/buffer.c | 26 +++++++++++++++++++++++---
+ 1 file changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/ogg123/buffer.c b/ogg123/buffer.c
+index b09c9c9..73290e2 100644
+--- a/ogg123/buffer.c
++++ b/ogg123/buffer.c
+@@ -209,8 +209,18 @@ void *buffer_thread_func (void *arg)
+      never be unset. */
+   while ( !(buf->eos && buf->curfill == 0) && !buf->abort_write) {
+ 
+-    if (buf->cancel_flag || sig_request.cancel)
++    if (buf->cancel_flag || sig_request.cancel) {
++      /* signal empty buffer space, so the main
++         thread can wake up to die in peace */
++
++      DEBUG("Abort: Wake up the writer thread");
++      LOCK_MUTEX(buf->mutex);
++      COND_SIGNAL(buf->write_cond);
++      UNLOCK_MUTEX(buf->mutex);
++
++      /* abort this thread, too */
+       break;
++    }
+ 
+     DEBUG("Check for something to play");
+     /* Block until we can play something */
+@@ -227,8 +237,18 @@ void *buffer_thread_func (void *arg)
+ 
+     UNLOCK_MUTEX(buf->mutex);
+ 
+-    if (buf->cancel_flag || sig_request.cancel)
++    if (buf->cancel_flag || sig_request.cancel) {
++      /* signal empty buffer space, so the main
++         thread can wake up to die in peace */
++
++      DEBUG("Abort: Wake up the writer thread");
++      LOCK_MUTEX(buf->mutex);
++      COND_SIGNAL(buf->write_cond);
++      UNLOCK_MUTEX(buf->mutex);
++
++      /* abort this thread, too */
+       break;
++    }
+ 
+     /* Don't need to lock buffer while running actions since position
+        won't change.  We clear out any actions before we compute the
+@@ -756,7 +776,7 @@ void buffer_wait_for_empty (buf_t *buf)
+   pthread_cleanup_push(buffer_mutex_unlock, buf);
+ 
+   LOCK_MUTEX(buf->mutex);
+-  while (!empty && !buf->abort_write) {
++  while (!empty && !buf->abort_write && !buf->cancel_flag && !sig_request.cancel) {
+ 
+     if (buf->curfill > 0) {
+       DEBUG1("Buffer curfill = %ld, going back to sleep.", buf->curfill);
diff --git a/debian/patches/series b/debian/patches/series
index 754ad6a..0f0e6dd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 0004-Fix-format-error-blocking-compilation-with-hardening.patch
 0005-Fix-URL-in-manpage.patch
 0006-Add-sampling-rate-sanity-check-to-avoid-crash.patch
+0007-Fix-ogg123-freeze-when-interrupting-at-End-Of-Stream.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-xiph/vorbis-tools.git



More information about the pkg-xiph-commits mailing list