From eb199ca207d69512d671607ddd9c2f3f9ac5c668 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 14 Nov 2008 17:55:51 +0100 Subject: player: don't queue song when there are 2 songs in the pipe Don't send a "next song" request to the main thread when the current song hasn't started playing yet, i.e. there are already two different songs in the music pipe. This would erase information about the song boundary within the music pipe, and thus triggered an assertion failure. The bug could occur when playing very short songs which fit into the pipe as a whole. --- src/player_thread.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/player_thread.c b/src/player_thread.c index 7570443da..ac060dda5 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -153,6 +153,9 @@ static void player_process_command(struct player *player) case PLAYER_COMMAND_QUEUE: assert(pc.next_song != NULL); + assert(!player->queued); + assert(player->next_song_chunk == -1); + player->queued = true; player_command_finished(); break; @@ -352,10 +355,12 @@ static void do_play(void) #endif if (decoder_is_idle() && !player.queued && + player.next_song_chunk < 0 && pc.next_song != NULL && pc.command == PLAYER_COMMAND_NONE) { /* the decoder has finished the current song; request the next song from the playlist */ + pc.next_song = NULL; wakeup_main_task(); } -- cgit v1.2.3