From ced765ceb32361af413f1510c074722fb6c9242d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 10 Aug 2014 01:06:52 +0200 Subject: [PATCH] avfilter/af_pan: check if the number of channels where sucessfully set Signed-off-by: Michael Niedermayer --- libavfilter/af_pan.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 1b78515b55..36395e995c 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -286,10 +286,14 @@ static int config_props(AVFilterLink *link) 0, ctx); if (!pan->swr) return AVERROR(ENOMEM); - if (!link->channel_layout) - av_opt_set_int(pan->swr, "ich", link->channels, 0); - if (!pan->out_channel_layout) - av_opt_set_int(pan->swr, "och", pan->nb_output_channels, 0); + if (!link->channel_layout) { + if (av_opt_set_int(pan->swr, "ich", link->channels, 0) < 0) + return AVERROR(EINVAL); + } + if (!pan->out_channel_layout) { + if (av_opt_set_int(pan->swr, "och", pan->nb_output_channels, 0) < 0) + return AVERROR(EINVAL); + } // gains are pure, init the channel mapping if (pan->pure_gains) {