aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_amix.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-05-30 08:48:26 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-05-30 16:20:03 -0400
commitc7bd556d482b3bb25bb6dd3bdf3542622d7cd482 (patch)
tree2437198c5846f40cf778cdb01f05cbcc10cc2f0c /libavfilter/af_amix.c
parent6163d880c0ac8b84b45d1f7a94719c5a0a6b5cb9 (diff)
downloadffmpeg-c7bd556d482b3bb25bb6dd3bdf3542622d7cd482.tar.gz
lavfi: amix: check active input count before calling request_samples
fixes use of the amix filter with only 1 input
Diffstat (limited to 'libavfilter/af_amix.c')
-rw-r--r--libavfilter/af_amix.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index 3399b7c051..d4af9a4234 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -389,6 +389,10 @@ static int request_frame(AVFilterLink *outlink)
int ret;
int wanted_samples, available_samples;
+ ret = calc_active_inputs(s);
+ if (ret < 0)
+ return ret;
+
if (s->input_state[0] == INPUT_OFF) {
ret = request_samples(ctx, 1);
if (ret < 0)
@@ -419,15 +423,16 @@ static int request_frame(AVFilterLink *outlink)
av_assert0(s->frame_list->nb_frames > 0);
wanted_samples = frame_list_next_frame_size(s->frame_list);
- ret = request_samples(ctx, wanted_samples);
- if (ret < 0)
- return ret;
-
- ret = calc_active_inputs(s);
- if (ret < 0)
- return ret;
if (s->active_inputs > 1) {
+ ret = request_samples(ctx, wanted_samples);
+ if (ret < 0)
+ return ret;
+
+ ret = calc_active_inputs(s);
+ if (ret < 0)
+ return ret;
+
available_samples = get_available_samples(s);
if (!available_samples)
return 0;