summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-04-25 11:36:45 +0200
committerMax Kellermann <max@duempel.org>2009-04-25 11:36:45 +0200
commit70faf5927531099af0701bf5281b37ff861d3e8d (patch)
tree914aa625a82875dd2f1da743f64a47b941ade64e
parent5ce625ea97f20f84b25025549930394a5098246c (diff)
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.
-rw-r--r--src/player_thread.c18
1 files 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 {