[vorbis-tools] 01/02: Fix ogg123 freeze when interrupting at End-Of-Stream.
Martin Steghöfer
martin.steghoefer-guest at moszumanska.debian.org
Thu Nov 6 17:51:54 UTC 2014
This is an automated email from the git hooks/post-receive script.
martin.steghoefer-guest pushed a commit to branch jessie-fixes
in repository vorbis-tools.
commit 256af4c034f2199db46054d6ca51d262ea3e2f56
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.
(Cherry-pick from c1bad216e679801286659604c403e037c783aea8 with modification to account for the fact that in this branch patches aren't formatted for gbp-pq)
---
...freeze-when-interrupting-at-end-of-stream.patch | 76 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 77 insertions(+)
diff --git a/debian/patches/fix-ogg123-freeze-when-interrupting-at-end-of-stream.patch b/debian/patches/fix-ogg123-freeze-when-interrupting-at-end-of-stream.patch
new file mode 100644
index 0000000..482f2a2
--- /dev/null
+++ b/debian/patches/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 9b6fad0..8d138a9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ dont-corrupt-stdout.patch
quality-check-first-scale-next.patch
format-security.patch
fix_xiph_url.diff
+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