From 563b4785dab5b4f12ffa6c29161eeb61168553e4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 6 Feb 2016 18:47:43 +0100 Subject: lavfi: fix EOF case This was dumb. Could make it burn 100% CPU and not exit at the end. (Because it would retry as instructed, instead of terminating playback.) It also needs to consider EOF as waiting for input. lavfi_process() will decide if it's really EOF, or if further input might come in the future. Without this, it'd would think that it does not need to wait for input, i.e. that new input will be available immediately. (Not so fond of the duplication of subtle logic.) --- player/lavfi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/player/lavfi.c b/player/lavfi.c index 40537c7ba8..76b47450ea 100644 --- a/player/lavfi.c +++ b/player/lavfi.c @@ -508,8 +508,9 @@ static void feed_input_pads(struct lavfi *c) MP_FATAL(c, "could not pass frame to filter\n"); av_frame_free(&frame); - pad->input_waiting = pad->input_again = false; + pad->input_again = false; pad->input_eof = eof; + pad->input_waiting = eof; // input _might_ come again in the future } } @@ -533,7 +534,7 @@ static void read_output_pads(struct lavfi *c) assert(pad->buffer); assert(!pad->pending_v && !pad->pending_a); - int r = AVERROR(EAGAIN); + int r = AVERROR_EOF; if (!pad->buffer_is_eof) r = av_buffersink_get_frame(pad->buffer, pad->tmp_frame); if (r >= 0) { @@ -690,7 +691,7 @@ void lavfi_send_status(struct lavfi_pad *pad, int status) assert(status != DATA_OK); assert(!pad->pending_v && !pad->pending_a); - pad->input_waiting = status == DATA_WAIT; + pad->input_waiting = status == DATA_WAIT || status == DATA_EOF; pad->input_again = status == DATA_AGAIN; pad->input_eof = status == DATA_EOF; } -- cgit v1.2.3