summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-30 22:29:24 +0200
committerwm4 <wm4@nowhere>2014-07-30 23:29:00 +0200
commit8d990408d70f33f72e77a275e02f2439ec34844b (patch)
treeea3f30b284f96a01eb3ea5f41468e7fec502276b
parent6afa1a2afc2ca5631d380477bc6d3e4ecc9865da (diff)
downloadmpv-8d990408d70f33f72e77a275e02f2439ec34844b.tar.bz2
mpv-8d990408d70f33f72e77a275e02f2439ec34844b.tar.xz
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.
-rw-r--r--player/audio.c4
1 files changed, 3 insertions, 1 deletions
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
}