From: Paul B Mahol <one...@gmail.com> Signed-off-by: Anton Khirnov <an...@khirnov.net> --- libavfilter/af_amix.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index aa42514106..120a97f48c 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -394,6 +394,8 @@ static int request_samples(AVFilterContext *ctx, int min_samples) int i; av_assert0(s->nb_inputs > 1); + if (min_samples == 1 && s->duration_mode == DURATION_FIRST) + min_samples = av_audio_fifo_size(s->fifos[0]); for (i = 1; i < s->nb_inputs; i++) { if (!(s->input_state[i] & INPUT_ON) || @@ -402,6 +404,7 @@ static int request_samples(AVFilterContext *ctx, int min_samples) if (av_audio_fifo_size(s->fifos[i]) >= min_samples) continue; ff_inlink_request_frame(ctx->inputs[i]); + return 0; } return output_frame(ctx->outputs[0]); } @@ -471,17 +474,13 @@ static int activate(AVFilterContext *ctx) if (ff_inlink_acknowledge_status(ctx->inputs[i], &status, &pts)) { if (status == AVERROR_EOF) { - if (i == 0) { - s->input_state[i] = 0; + s->input_state[i] |= INPUT_EOF; + if (av_audio_fifo_size(s->fifos[i]) == 0) { + s->input_state[i] &= ~INPUT_ON; if (s->nb_inputs == 1) { ff_outlink_set_status(outlink, status, pts); return 0; } - } else { - s->input_state[i] |= INPUT_EOF; - if (av_audio_fifo_size(s->fifos[i]) == 0) { - s->input_state[i] = 0; - } } } } -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".