player: fix confusion in audio resync code

Just the audio resync code in its normal state: buggy. This time,
AD_NO_PROGRESS was handled about the same as AD_WAIT. But it means the
decoder didn't output data, even though input is still readily
available.

This happened in particular when the timeline code was used (potentially
skipping many packets), and thus should fix #4688.
This commit is contained in:
wm4 2017-08-08 14:55:02 +02:00
parent 8ef50016be
commit 0e0b87b6f3
1 changed files with 6 additions and 2 deletions

View File

@ -878,7 +878,9 @@ static int filter_audio(struct MPContext *mpctx, struct mp_audio_buffer *outbuf,
break; break;
res = decode_new_frame(ao_c); res = decode_new_frame(ao_c);
if (res == AD_NO_PROGRESS || res == AD_WAIT) if (res == AD_NO_PROGRESS)
continue;
if (res == AD_WAIT)
break; break;
if (res < 0) { if (res < 0) {
// drain filters first (especially for true EOF case) // drain filters first (especially for true EOF case)
@ -970,7 +972,9 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
if (ao_c->af->initialized < 1 || !mpctx->ao) { if (ao_c->af->initialized < 1 || !mpctx->ao) {
// Probe the initial audio format. Returns AD_OK (and does nothing) if // Probe the initial audio format. Returns AD_OK (and does nothing) if
// the format is already known. // the format is already known.
int r = decode_new_frame(mpctx->ao_chain); int r = AD_NO_PROGRESS;
while (r == AD_NO_PROGRESS)
r = decode_new_frame(mpctx->ao_chain);
if (r == AD_WAIT) if (r == AD_WAIT)
return; // continue later when new data is available return; // continue later when new data is available
if (r == AD_EOF) { if (r == AD_EOF) {