diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-27 02:03:07 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-28 14:19:00 -0700 |
commit | 7812cd9286fa7581b5ea18337e875ad98a2d8bd6 (patch) | |
tree | ba9899abacb25162ec0c8e64eea06033748cc5ad /src/decode.c | |
parent | c7955f31bc044510ed3a2fb84c5e6590e8cbd428 (diff) | |
download | mpd-7812cd9286fa7581b5ea18337e875ad98a2d8bd6.tar.gz mpd-7812cd9286fa7581b5ea18337e875ad98a2d8bd6.tar.xz mpd-7812cd9286fa7581b5ea18337e875ad98a2d8bd6.zip |
advance to the next song on decoder errors
Fix this regression introduced in the core rewrite so that we
now skip to the next song when we encounter an error with the
song we tried to decode.
Diffstat (limited to 'src/decode.c')
-rw-r--r-- | src/decode.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/decode.c b/src/decode.c index 90ec5bd37..e0685e0e9 100644 --- a/src/decode.c +++ b/src/decode.c @@ -166,7 +166,7 @@ static void finalize_per_track_actions(void) /* DEBUG(":%s dc.action(%d): %d\n", __func__,__LINE__, dc.action); */ } -static void decode_start(void) +static int decode_start(void) { int err = -1; int close_instream = 1; @@ -203,7 +203,7 @@ static void decode_start(void) if (openInputStream(&is, path_max_fs) < 0) { DEBUG("couldn't open song: %s\n", path_max_fs); player_seterror(PLAYER_ERROR_FILENOTFOUND, dc.current_song); - return; + return err; } if (isRemoteUrl(path_max_utf8)) { @@ -281,6 +281,7 @@ static void decode_start(void) ERROR("player_error: %s\n", player_strerror()); if (close_instream) closeInputStream(&is); + return err; } static void * decoder_task(mpd_unused void *arg) @@ -300,12 +301,17 @@ static void * decoder_task(mpd_unused void *arg) /* DEBUG("dc.action: %d\n", (int)dc.action); */ if ((dc.current_song = playlist_queued_song())) { char p[MPD_PATH_MAX]; + int err; + ob_advance_sequence(); get_song_url(p, dc.current_song); DEBUG("decoding song: %s\n", p); - decode_start(); + err = decode_start(); DEBUG("DONE decoding song: %s\n", p); - ob_flush(); + if (err) + ob_trigger_action(OB_ACTION_RESET); + else + ob_flush(); dc.current_song = NULL; } finalize_per_track_actions(); |