From 7791e25fa0a795c7e042c3938405024468669c29 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 6 Sep 2014 13:24:44 +0200 Subject: audio: fix initial sync with huge AO buffer With e.g --start=-3 --audio-buffer=10 the decoder entered EOF state before the initial sync was finished, entered STATUS_EOF, and just started playing audio from a random position. This doesn't handle seeking outside of the file, which is a different case. E.g. --start=30:00 with audio and video enabled in a file shorter than 30:00 will play a random last part of audio. This could perhaps be fixed by using the hr-seek target for cutting audio, instead of the video PTS, but that would be kind of intrusive, so don't do it for now. The simpler solution, assuming audio EOF on video EOF, wouldn't work, because we allow audio to start before video, or to last after video. --- player/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index 958269ec65..5de4fd449e 100644 --- a/player/audio.c +++ b/player/audio.c @@ -466,7 +466,7 @@ void fill_audio_out_buffers(struct MPContext *mpctx, double endpts) if (mpctx->audio_status == STATUS_SYNCING) { if (end_sync) mpctx->audio_status = STATUS_FILLING; - if (status != AD_OK) + if (status != AD_OK && !mp_audio_buffer_samples(mpctx->ao_buffer)) mpctx->audio_status = STATUS_EOF; mpctx->sleeptime = 0; return; // continue on next iteration -- cgit v1.2.3