summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-06 18:47:43 +0100
committerwm4 <wm4@nowhere>2016-02-06 19:13:32 +0100
commit563b4785dab5b4f12ffa6c29161eeb61168553e4 (patch)
treedf8c318106507df261694c5c383a76cac978b26e
parenta0d3ce48192507dcd0ebaccbe6b3428b43964c08 (diff)
downloadmpv-563b4785dab5b4f12ffa6c29161eeb61168553e4.tar.bz2
mpv-563b4785dab5b4f12ffa6c29161eeb61168553e4.tar.xz
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.)
-rw-r--r--player/lavfi.c7
1 files 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;
}