aboutsummaryrefslogtreecommitdiffstats
path: root/src/outputBuffer.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-15 05:57:22 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-15 05:57:22 +0000
commit7c952c4f4bb4272cd4082f85960eb65976286aa4 (patch)
tree0670febd814893b67812084f04fb332f75e01757 /src/outputBuffer.h
parent071c8f4ac760eca2e47a33764dcbe4bf004e87f3 (diff)
downloadmpd-7c952c4f4bb4272cd4082f85960eb65976286aa4.tar.gz
mpd-7c952c4f4bb4272cd4082f85960eb65976286aa4.tar.xz
mpd-7c952c4f4bb4272cd4082f85960eb65976286aa4.zip
added ob_set_lazy()
In lazy mode (previously the default), outputBuffer.c only wakes up the player when it was previously empty. That caused a deadlock when the player was waiting for buffered_before_play, since the decoder wouldn't wake up the player when buffered_before_play was reached. In non-lazy mode, always wake up the player when a new chunk was decoded. git-svn-id: https://svn.musicpd.org/mpd/trunk@7364 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/outputBuffer.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/outputBuffer.h b/src/outputBuffer.h
index 6e9d7c49f..4aea59120 100644
--- a/src/outputBuffer.h
+++ b/src/outputBuffer.h
@@ -53,6 +53,10 @@ typedef struct _OutputBuffer {
/** the index after the last decoded chunk */
unsigned int volatile end;
+ /** non-zero if the player thread should only we woken up if
+ the buffer becomes non-empty */
+ int lazy;
+
AudioFormat audioFormat;
ConvState convState;
} OutputBuffer;
@@ -65,6 +69,14 @@ void ob_clear(void);
void ob_flush(void);
+/**
+ * When a chunk is decoded, we wake up the player thread to tell him
+ * about it. In "lazy" mode, we only wake him up when the buffer was
+ * previously empty, i.e. when the player thread has really been
+ * waiting for us.
+ */
+void ob_set_lazy(int lazy);
+
/** is the buffer empty? */
int ob_is_empty(void);