mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
6afa1a2afc
commit
8d990408d7
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue