[FFmpeg-cvslog] avfilter/af_amix: fix possible hang
Paul B Mahol
git at videolan.org
Sun Jun 18 22:07:22 EEST 2017
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Jun 18 18:38:36 2017 +0200| [478a1949d92002969786d1422f9f860d8d6456de] | committer: Paul B Mahol
avfilter/af_amix: fix possible hang
Fixes #6424.
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=478a1949d92002969786d1422f9f860d8d6456de
---
libavfilter/af_amix.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index 9fe505b0dc..f19e6b39a5 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -268,7 +268,7 @@ static int calc_active_inputs(MixContext *s);
/**
* Read samples from the input FIFOs, mix, and write to the output link.
*/
-static int output_frame(AVFilterLink *outlink)
+static int output_frame(AVFilterLink *outlink, int need_request)
{
AVFilterContext *ctx = outlink->src;
MixContext *s = ctx->priv;
@@ -288,7 +288,7 @@ static int output_frame(AVFilterLink *outlink)
if (ns < nb_samples) {
if (!(s->input_state[i] & INPUT_EOF))
/* unclosed input with not enough samples */
- return 0;
+ return need_request ? ff_request_frame(ctx->inputs[i]) : 0;
/* closed input to drain */
nb_samples = ns;
}
@@ -387,7 +387,7 @@ static int request_samples(AVFilterContext *ctx, int min_samples)
} else if (ret < 0)
return ret;
}
- return output_frame(ctx->outputs[0]);
+ return output_frame(ctx->outputs[0], 1);
}
/**
@@ -431,7 +431,7 @@ static int request_frame(AVFilterLink *outlink)
s->input_state[0] = 0;
if (s->nb_inputs == 1)
return AVERROR_EOF;
- return output_frame(ctx->outputs[0]);
+ return output_frame(ctx->outputs[0], 1);
}
return ret;
}
@@ -470,7 +470,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
buf->nb_samples);
av_frame_free(&buf);
- return output_frame(outlink);
+ return output_frame(outlink, 0);
fail:
av_frame_free(&buf);
More information about the ffmpeg-cvslog
mailing list