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.
This commit is contained in:
Max Kellermann 2009-03-10 21:19:51 +01:00
parent 2b57863144
commit 538701e7c6
2 changed files with 10 additions and 3 deletions

1
NEWS
View File

@ -52,6 +52,7 @@ ver 0.15 - (200?/??/??)
* listen: fix broken client IP addresses in log * listen: fix broken client IP addresses in log
* 32 bit audio support * 32 bit audio support
* Print available protocols in --version * Print available protocols in --version
* fill buffer after seeking
ver 0.14.2 (2009/02/13) ver 0.14.2 (2009/02/13)

View File

@ -300,9 +300,8 @@ static bool player_seek_decoder(struct player *player)
player->xfade = XFADE_UNKNOWN; player->xfade = XFADE_UNKNOWN;
/* abort buffering when the user has requested /* re-fill the buffer after seeking */
a seek */ player->buffering = true;
player->buffering = false;
audio_output_all_cancel(); audio_output_all_cancel();
@ -588,6 +587,13 @@ static void do_play(void)
if (music_pipe_size(player.pipe) < pc.buffered_before_play && if (music_pipe_size(player.pipe) < pc.buffered_before_play &&
!decoder_is_idle()) { !decoder_is_idle()) {
/* not enough decoded buffer space yet */ /* 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); notify_wait(&pc.notify);
continue; continue;
} else { } else {