diff mbox

[FFmpeg-devel] avfilter/af_join: detect EOF immediately

Message ID 20170825184241.457-1-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol Aug. 25, 2017, 6:42 p.m. UTC
Prevents hang.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/af_join.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Nicolas George Aug. 26, 2017, 9:25 a.m. UTC | #1
L'octidi 8 fructidor, an CCXXV, Paul B Mahol a écrit :
> Prevents hang.
> 
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavfilter/af_join.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Probably not 100% correct, but it comes from the fork, with the old
broken scheduling, so no objection is it fixes something.

Rewriting amerge to use activate() is high in my priorities.

Regards,
Paul B Mahol May 4, 2018, 8:37 a.m. UTC | #2
On 8/26/17, Nicolas George <george@nsup.org> wrote:
> L'octidi 8 fructidor, an CCXXV, Paul B Mahol a ecrit :
>> Prevents hang.
>>
>> Signed-off-by: Paul B Mahol <onemda@gmail.com>
>> ---
>>  libavfilter/af_join.c | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> Probably not 100% correct, but it comes from the fork, with the old
> broken scheduling, so no objection is it fixes something.
>
> Rewriting amerge to use activate() is high in my priorities.

Have you started work on this?
diff mbox

Patch

diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index f8af0a1..7fbab47 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -24,6 +24,9 @@ 
  * a single output
  */
 
+#define FF_INTERNAL_FIELDS 1
+#include "framequeue.h"
+
 #include "libavutil/avassert.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
@@ -402,13 +405,16 @@  static int join_request_frame(AVFilterLink *outlink)
 {
     AVFilterContext *ctx = outlink->src;
     JoinContext *s       = ctx->priv;
-    int i;
+    int i, ret;
 
     /* get a frame on each input */
     for (i = 0; i < ctx->nb_inputs; i++) {
         AVFilterLink *inlink = ctx->inputs[i];
-        if (!s->input_frames[i])
-            return ff_request_frame(inlink);
+        if (!s->input_frames[i] ||
+            /* detect EOF immediately */
+            (ctx->inputs[i]->status_in && !ctx->inputs[i]->status_out))
+            if ((ret = ff_request_frame(inlink)) < 0)
+                return ret;
     }
     return 0;
 }