From 8d990408d70f33f72e77a275e02f2439ec34844b Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 30 Jul 2014 22:29:24 +0200 Subject: audio: better sync behavior on bogus EOF In situations when the demuxer reports EOF, but immediately "recovers" after that and returns new data, it could happen that audio sync was skipped. Deal with this by actually entering the EOF state, instead of assuming this will happen later. --- player/audio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index f371b69bb4..5fcc2cbd22 100644 --- a/player/audio.c +++ b/player/audio.c @@ -414,7 +414,7 @@ void fill_audio_out_buffers(struct MPContext *mpctx, double endpts) return; // retry on next iteration } - bool end_sync = status != AD_OK; // (on error/EOF, start playback immediately) + bool end_sync = false; if (skip >= 0) { int max = mp_audio_buffer_samples(mpctx->ao_buffer); mp_audio_buffer_skip(mpctx->ao_buffer, MPMIN(skip, max)); @@ -434,6 +434,8 @@ 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) + mpctx->audio_status = STATUS_EOF; mpctx->sleeptime = 0; return; // continue on next iteration } -- cgit v1.2.3