aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2016-12-24 10:33:33 +0100
committerNicolas George <george@nsup.org>2016-12-24 13:18:02 +0100
commit3b64e3ea45c580c5e158c086f2eb7c65635fc33b (patch)
treecac4ea94c8b3f8c566e4843cf6498e997e1ffa1a /libavfilter
parent68e5598e22b6b51cd796b55c4111ccd1638474d9 (diff)
downloadffmpeg-3b64e3ea45c580c5e158c086f2eb7c65635fc33b.tar.gz
lavf/framesync: detect EOF immediately.
Fix an infinite loop in forward_status_change().
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/framesync.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index 7920cdb379..eb05d66a86 100644
--- a/libavfilter/framesync.c
+++ b/libavfilter/framesync.c
@@ -18,6 +18,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#define FF_INTERNAL_FIELDS 1
+#include "framequeue.h"
+
#include "libavutil/avassert.h"
#include "avfilter.h"
#include "bufferqueue.h"
@@ -314,7 +317,7 @@ int ff_framesync_filter_frame(FFFrameSync *fs, AVFilterLink *inlink,
int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
- int input, ret;
+ int input, ret, i;
if ((ret = ff_framesync_process_frame(fs, 0)) < 0)
return ret;
@@ -323,6 +326,11 @@ int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink)
if (fs->eof)
return AVERROR_EOF;
input = fs->in_request;
+ /* Detect status change early */
+ for (i = 0; i < fs->nb_in; i++)
+ if (!ff_framequeue_queued_frames(&ctx->inputs[i]->fifo) &&
+ ctx->inputs[i]->status_in && !ctx->inputs[i]->status_out)
+ input = i;
ret = ff_request_frame(ctx->inputs[input]);
if (ret == AVERROR_EOF) {
if ((ret = ff_framesync_add_frame(fs, input, NULL)) < 0)