From f7018dc659b3a219e0c90516375212853204001a Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 29 Jan 2017 22:07:51 +0100 Subject: [PATCH] [player] Skip/remove unplayable tracks in queue instead of aborting --- src/player.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/player.c b/src/player.c index 7ec14dad..129210ed 100644 --- a/src/player.c +++ b/src/player.c @@ -1010,20 +1010,31 @@ source_switch(int nbytes) source_close(last_rtptime + AIRTUNES_V2_PACKET_SAMPLES + BTOS(nbytes) - 1); - ps = source_next(); - if (!ps) + while ((ps = source_next())) { - cur_streaming = NULL; - return 0; // End of queue + ret = source_open(ps, cur_streaming->end + 1, 0); + if (ret < 0) + { + db_queue_delete_byitemid(ps->item_id); + continue; + } + + ret = source_play(); + if (ret < 0) + { + db_queue_delete_byitemid(ps->item_id); + source_close(last_rtptime + AIRTUNES_V2_PACKET_SAMPLES + BTOS(nbytes) - 1); + continue; + } + + break; } - ret = source_open(ps, cur_streaming->end + 1, 0); - if (ret < 0) - return -1; - - ret = source_play(); - if (ret < 0) - return -1; + if (!ps) // End of queue + { + cur_streaming = NULL; + return 0; + } metadata_trigger(0);