summaryrefslogtreecommitdiff
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
parentcd78d819263c8aa757bd7b84fb1c037c405b722a (diff)
fixed hanging on bad files in playlist
-rw-r--r--playlist.c5
-rw-r--r--streamer.c21
2 files changed, 24 insertions, 2 deletions
diff --git a/playlist.c b/playlist.c
index 94f2181e..8b15bdf1 100644
--- a/playlist.c
+++ b/playlist.c
@@ -647,7 +647,10 @@ pl_set_current (playItem_t *it) {
// don't do anything on fail, streamer will take care
ret = it->codec->init (it);
if (ret < 0) {
- it->codec->info.samplesPerSecond = -1;
+// pl_item_free (&playlist_current);
+// playlist_current_ptr = NULL;
+// return ret;
+//// it->codec->info.samplesPerSecond = -1;
}
}
if (playlist_current_ptr) {
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 ();