From c3916406451cddfb9daa42699dcd2163bff1a0eb Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 11 Aug 2017 21:28:01 +0200 Subject: player: fix --lavfi-complex freeze Commit 0e0b87b6f3297 fixed that dropped packets did not trigger further work correctly. But it also made trivial --lavfi-complex freeze. The reason is that the meaning if DATA_AGAIN was overloaded: the decoders meant that they should be called again, while lavfi.c meant that other outputs needed to be checked again. Rename the latter meaning to DATA_STARVE, which means that the current input will deliver no more data, until "other" work has been done (like reading other outputs, or feeding input). The decoders never return DATA_STARVE, because they don't get input from the player core (instead, they get it from the demuxer directly, which is why they still can return DATA_WAIT). Also document the DATA_* semantics in the enum. Fixes #4746. --- player/audio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'player/audio.c') diff --git a/player/audio.c b/player/audio.c index 62a5ddb5d6..7891116c7e 100644 --- a/player/audio.c +++ b/player/audio.c @@ -51,6 +51,7 @@ enum { AD_NEW_FMT = -3, AD_WAIT = -4, AD_NO_PROGRESS = -5, + AD_STARVE = -6, }; // Use pitch correction only for speed adjustments by the user, not minor sync @@ -846,6 +847,7 @@ static int decode_new_frame(struct ao_chain *ao_c) case DATA_OK: return AD_OK; case DATA_WAIT: return AD_WAIT; case DATA_AGAIN: return AD_NO_PROGRESS; + case DATA_STARVE: return AD_STARVE; case DATA_EOF: return AD_EOF; default: abort(); } @@ -880,7 +882,7 @@ static int filter_audio(struct MPContext *mpctx, struct mp_audio_buffer *outbuf, res = decode_new_frame(ao_c); if (res == AD_NO_PROGRESS) continue; - if (res == AD_WAIT) + if (res == AD_WAIT || res == AD_STARVE) break; if (res < 0) { // drain filters first (especially for true EOF case) -- cgit v1.2.3