From 70faf5927531099af0701bf5281b37ff861d3e8d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 25 Apr 2009 11:36:45 +0200 Subject: player_thread: pause when output fails while seeking When no audio outputs could be opened while seeking, leave MPD seeked at that position and pause playback. The user may continue from this point at any time, as soon as the audio outputs are fixed. The old behaviour triggered an assertion failure: the failure wasn't passed properly to the do_play() function, which attempted to play audio chunks. --- src/player_thread.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/player_thread.c b/src/player_thread.c index 02f80ae8c..39eb3a385 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -197,6 +197,11 @@ player_check_decoder_startup(struct player *player) all chunks yet - wait for that */ return true; + pc.total_time = dc.total_time; + pc.audio_format = dc.in_audio_format; + player->play_audio_format = dc.out_audio_format; + player->size_to_time = + audioFormatSizeToTime(&dc.out_audio_format); player->decoder_starting = false; if (!player->paused && @@ -210,14 +215,13 @@ player_check_decoder_startup(struct player *player) assert(dc.next_song == NULL || dc.next_song->url != NULL); pc.errored_song = dc.next_song; pc.error = PLAYER_ERROR_AUDIO; - return false; - } - pc.total_time = dc.total_time; - pc.audio_format = dc.in_audio_format; - player->play_audio_format = dc.out_audio_format; - player->size_to_time = - audioFormatSizeToTime(&dc.out_audio_format); + /* pause: the user may resume playback as soon + as an audio output becomes available */ + pc.state = PLAYER_STATE_PAUSE; + player->paused = true; + return true; + } return true; } else { -- cgit v1.2.3