aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_api.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-10-31 17:02:12 +0100
committerMax Kellermann <max@duempel.org>2009-10-31 17:02:12 +0100
commit25a806a347ce420126eb75d82c5fb875eb0a5e0d (patch)
tree0d39bed8c073a720acd42f17b04dbee91b0a8c01 /src/decoder_api.c
parent73cff374fd94a1c16e0201fcda020396c0f41962 (diff)
downloadmpd-25a806a347ce420126eb75d82c5fb875eb0a5e0d.tar.gz
mpd-25a806a347ce420126eb75d82c5fb875eb0a5e0d.tar.xz
mpd-25a806a347ce420126eb75d82c5fb875eb0a5e0d.zip
player_control: protect command, state, error with a mutex
Use GMutex/GCond instead of the notify library. Manually lock the player_control object before accessing the protected attributes. Use the GCond object to notify the player thread and the main thread.
Diffstat (limited to '')
-rw-r--r--src/decoder_api.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 4cff9916c..070151a67 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -61,7 +61,7 @@ void decoder_initialized(G_GNUC_UNUSED struct decoder * decoder,
dc.state = DECODE_STATE_DECODE;
decoder_unlock();
- notify_signal(&pc.notify);
+ player_lock_signal();
g_debug("audio_format=%u:%u:%u, seekable=%s",
dc.in_audio_format.sample_rate, dc.in_audio_format.bits,
@@ -112,7 +112,7 @@ void decoder_command_finished(G_GNUC_UNUSED struct decoder * decoder)
dc.command = DECODE_COMMAND_NONE;
decoder_unlock();
- notify_signal(&pc.notify);
+ player_lock_signal();
}
double decoder_seek_where(G_GNUC_UNUSED struct decoder * decoder)
@@ -184,7 +184,7 @@ do_send_tag(struct decoder *decoder, struct input_stream *is,
/* there is a partial chunk - flush it, we want the
tag in a new chunk */
decoder_flush_chunk(decoder);
- notify_signal(&pc.notify);
+ player_lock_signal();
}
assert(decoder->chunk == NULL);
@@ -297,7 +297,7 @@ decoder_data(struct decoder *decoder,
if (dest == NULL) {
/* the chunk is full, flush it */
decoder_flush_chunk(decoder);
- notify_signal(&pc.notify);
+ player_lock_signal();
continue;
}
@@ -324,7 +324,7 @@ decoder_data(struct decoder *decoder,
if (full) {
/* the chunk is full, flush it */
decoder_flush_chunk(decoder);
- notify_signal(&pc.notify);
+ player_lock_signal();
}
data += nbytes;