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.
This commit is contained in:
Max Kellermann 2008-11-14 17:55:51 +01:00
parent 418dac6f94
commit eb199ca207

View File

@ -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();
}