aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-04-19 19:02:32 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-04-27 12:57:43 -0400
commit168f9e8c40cf383802c8c8059f283a6ea789ec1e (patch)
tree28594fde91a903ddabe69de3a6c2565b05a3fd00 /libavcodec/utils.c
parent3dfc3e70c0852c62a45923b8abb57137e4bf6240 (diff)
downloadffmpeg-168f9e8c40cf383802c8c8059f283a6ea789ec1e.tar.gz
If AVCodecContext.channel_layout and AVCodecContext.channels are both
non-zero, check to make sure they do not contradict eachother.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8bb4d1927e..e4ea1e5bf7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -578,6 +578,13 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
}
}
}
+ if (avctx->channel_layout && avctx->channels) {
+ if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) {
+ av_log(avctx, AV_LOG_ERROR, "channel layout does not match number of channels\n");
+ ret = AVERROR(EINVAL);
+ goto free_and_end;
+ }
+ }
}
if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){