From 7812cd9286fa7581b5ea18337e875ad98a2d8bd6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 27 Sep 2008 02:03:07 -0700 Subject: 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. --- src/decode.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/decode.c') 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(); -- cgit v1.2.3