mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 23:02:37 +00:00
audio: stop being dumb
Obvious mistake: we entered EOF drain mode if the decoder returned AD_WAIT, which is very wrong. AD_WAIT means we should retry after waiting for a while (or to be precise, until the demuxer/decoder have more data). We should just pass down this status, and not change the audio chain state. This was exposed by a libavfilter EOF handling bug. Feeding a filter chain with af_dynaudnorm, and sending an EOF before a frame is returned makes it stuck and keeps returning EAGAIN, instead of returning the buffered audio. In combination with the bug at hand, which entered EOG drain mode, it could happen that it got stuck due to libavfilter discarding buffered data each time the demuxer ran out of data. Fixes #3997.
This commit is contained in:
parent
e0f25010c7
commit
c4ad2732f9
@ -817,7 +817,7 @@ static int filter_audio(struct MPContext *mpctx, struct mp_audio_buffer *outbuf,
|
||||
break;
|
||||
|
||||
res = decode_new_frame(ao_c);
|
||||
if (res == AD_NO_PROGRESS)
|
||||
if (res == AD_NO_PROGRESS || res == AD_WAIT)
|
||||
break;
|
||||
if (res < 0) {
|
||||
// drain filters first (especially for true EOF case)
|
||||
|
Loading…
Reference in New Issue
Block a user