diff options
author | Max Kellermann <max@duempel.org> | 2009-03-10 21:19:51 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-10 21:19:51 +0100 |
commit | 538701e7c612cf68f7bbadc2329046b09062a988 (patch) | |
tree | 5525613b893738c9298fb60555ad72b377e6064d /src | |
parent | 2b5786314420a2d527d2b3b1078dc8625fcb73d5 (diff) | |
download | mpd-538701e7c612cf68f7bbadc2329046b09062a988.tar.gz mpd-538701e7c612cf68f7bbadc2329046b09062a988.tar.xz mpd-538701e7c612cf68f7bbadc2329046b09062a988.zip |
player_thread: fill buffer after seeking
After a seek, wait until enough new chunks are decoded before starting
playback. If this takes too long, send silence chunks to the audio
outputs meanwhile.
Diffstat (limited to 'src')
-rw-r--r-- | src/player_thread.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index a41fc5c01..35d403044 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -300,9 +300,8 @@ static bool player_seek_decoder(struct player *player) player->xfade = XFADE_UNKNOWN; - /* abort buffering when the user has requested - a seek */ - player->buffering = false; + /* re-fill the buffer after seeking */ + player->buffering = true; audio_output_all_cancel(); @@ -588,6 +587,13 @@ static void do_play(void) if (music_pipe_size(player.pipe) < pc.buffered_before_play && !decoder_is_idle()) { /* not enough decoded buffer space yet */ + + if (!player.paused && + audio_format_defined(&player.play_audio_format) && + audio_output_all_check() < 4 && + !player_send_silence(&player)) + break; + notify_wait(&pc.notify); continue; } else { |