diff mbox

[FFmpeg-devel] avfilter/framesync: fix shortest with eof_action=pass

Message ID 8ee9ddce-e13f-bb31-2884-c050b2ebdf74@gyani.pro
State Accepted
Commit 3be44900144267f657d935c31130d9377d8a722b
Headers show

Commit Message

Gyan Doshi June 5, 2019, 2:28 p.m. UTC
With current order, shortest gets ignored with eof_action=pass

Gyan
From 61834c8a9d8b01c2a82a001d2974d6389f7f7c49 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@gyani.pro>
Date: Wed, 5 Jun 2019 19:52:04 +0530
Subject: [PATCH] avfilter/framesync: fix shortest with eof_action=pass

Shifted check of shortest to after repeatlast,
to ensure shortest=1 is always honoured.
---
 libavfilter/framesync.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Nicolas George June 5, 2019, 3:36 p.m. UTC | #1
Gyan (12019-06-05):
> With current order, shortest gets ignored with eof_action=pass

Enabling both does not make much sense. A warning may be a better idea.
But no objection.

Regards,
Gyan Doshi June 5, 2019, 4:10 p.m. UTC | #2
On 05-06-2019 09:06 PM, Nicolas George wrote:
> Gyan (12019-06-05):
>> With current order, shortest gets ignored with eof_action=pass
> Enabling both does not make much sense. A warning may be a better idea.
> But no objection.
This is to just to fix an edge case, for the careless user. Will apply.

BTW, what is the purpose of the repeatlast option, given the possibility 
of eof_action=repeat?

Gyan
diff mbox

Patch

diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index 22d3f091a3..bc95f7d904 100644
--- a/libavfilter/framesync.c
+++ b/libavfilter/framesync.c
@@ -127,16 +127,16 @@  int ff_framesync_configure(FFFrameSync *fs)
         fs->opt_shortest = 1;
         fs->opt_eof_action = EOF_ACTION_ENDALL;
     }
-    if (fs->opt_shortest) {
-        for (i = 0; i < fs->nb_in; i++)
-            fs->in[i].after = EXT_STOP;
-    }
     if (!fs->opt_repeatlast) {
         for (i = 1; i < fs->nb_in; i++) {
             fs->in[i].after = EXT_NULL;
             fs->in[i].sync  = 0;
         }
     }
+    if (fs->opt_shortest) {
+        for (i = 0; i < fs->nb_in; i++)
+            fs->in[i].after = EXT_STOP;
+    }
 
     if (!fs->time_base.num) {
         for (i = 0; i < fs->nb_in; i++) {