summaryrefslogtreecommitdiff
path: root/streamer.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-17 20:23:30 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-17 20:23:30 +0200
commite17823663289e21e043fbf32e8d26bc133a7b3fe (patch)
treebc6039c5afd72777176e90730b51422f705948b0 /streamer.c
parentcd78d819263c8aa757bd7b84fb1c037c405b722a (diff)
fixed hanging on bad files in playlist
Diffstat (limited to 'streamer.c')
-rw-r--r--streamer.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/streamer.c b/streamer.c
index b89717fd..cebd9eed 100644
--- a/streamer.c
+++ b/streamer.c
@@ -45,6 +45,7 @@ static char streambuffer[STREAM_BUFFER_SIZE];
static uintptr_t mutex;
static int nextsong = -1;
static int nextsong_pstate = -1;
+static int badsong = -1;
static float seekpos = -1;
@@ -82,7 +83,25 @@ streamer_thread (uintptr_t ctx) {
codec_lock ();
codecleft = 0;
codec_unlock ();
- pl_set_current (pl_get_for_idx (sng));
+ if (badsong == sng) {
+ //printf ("looped to bad file. stopping...\n");
+ streamer_set_nextsong (-2, 1);
+ badsong = -1;
+ continue;
+ }
+ int ret = pl_set_current (pl_get_for_idx (sng));
+ if (ret < 0) {
+ //printf ("bad file in playlist, skipping...\n");
+ // remember bad song number in case of looping
+ if (badsong == -1) {
+ badsong = sng;
+ }
+ // try jump to next song
+ pl_nextsong (0);
+ usleep (3000);
+ continue;
+ }
+ badsong = -1;
playpos = 0;
if (pstate == 0) {
p_stop ();