1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-18 13:47:04 +00:00

audio: go to draining state instead of EOF if audio starts later

Probably no observable effect, but it's more correct. Setting audio to
EOF could have bad effects otherwise (anywhere the player logic for
example decides whether EOF was reached, and such).
This commit is contained in:
wm4 2014-08-31 14:47:05 +02:00
parent fd4045965e
commit fc0fa9a221

View File

@ -434,7 +434,7 @@ void fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
// If EOF was reached before, but now something can be decoded, try to // If EOF was reached before, but now something can be decoded, try to
// restart audio properly. This helps with video files where audio starts // restart audio properly. This helps with video files where audio starts
// later. Retrying is needed to get the correct sync PTS. // later. Retrying is needed to get the correct sync PTS.
if (mpctx->audio_status == STATUS_EOF && status == AD_OK) { if (mpctx->audio_status >= STATUS_DRAINING && status == AD_OK) {
mpctx->audio_status = STATUS_SYNCING; mpctx->audio_status = STATUS_SYNCING;
mpctx->sleeptime = 0; mpctx->sleeptime = 0;
return; // retry on next iteration return; // retry on next iteration
@ -449,7 +449,7 @@ void fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
} else if (skip < 0) { } else if (skip < 0) {
if (-skip > playsize) { // heuristic against making the buffer too large if (-skip > playsize) { // heuristic against making the buffer too large
ao_reset(mpctx->ao); // some AOs repeat data on underflow ao_reset(mpctx->ao); // some AOs repeat data on underflow
mpctx->audio_status = STATUS_EOF; mpctx->audio_status = STATUS_DRAINING;
mpctx->delay = 0; mpctx->delay = 0;
return; return;
} }