aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-03 19:17:52 +0100
committerMax Kellermann <max@duempel.org>2009-11-03 19:17:52 +0100
commit77a647fc2695f95dcf47bb42fd3a6cd519d99736 (patch)
treefa7c80469a662bb77f5aedc771e04152ad5e02cd /src
parent59ffb5b7c126194f3cb74129837961ee849933fa (diff)
downloadmpd-77a647fc2695f95dcf47bb42fd3a6cd519d99736.tar.gz
mpd-77a647fc2695f95dcf47bb42fd3a6cd519d99736.tar.xz
mpd-77a647fc2695f95dcf47bb42fd3a6cd519d99736.zip
decoder_thread: open input stream after command finished
Return the result to the caller more quickly. This unifies error handling: no error can be reported before the command is finished.
Diffstat (limited to 'src')
-rw-r--r--src/decoder_thread.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index 2f643d454..eca8d8599 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -101,11 +101,6 @@ decoder_run_song(struct decoder_control *dc,
struct input_stream input_stream;
const struct decoder_plugin *plugin;
- if (!input_stream_open(&input_stream, uri)) {
- dc->state = DECODE_STATE_ERROR;
- return;
- }
-
decoder.seeking = false;
decoder.song_tag = song->tag != NULL && song_is_file(song)
? tag_dup(song->tag) : NULL;
@@ -118,6 +113,16 @@ decoder_run_song(struct decoder_control *dc,
player_signal();
+ decoder_unlock(dc);
+
+ if (!input_stream_open(&input_stream, uri)) {
+ decoder_lock(dc);
+ dc->state = DECODE_STATE_ERROR;
+ return;
+ }
+
+ decoder_lock(dc);
+
/* wait for the input stream to become ready; its metadata
will be available then */