diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-02 13:39:53 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-02 13:43:57 +0100 |
commit | db9f426caba574719c58de12e68742063c8e7979 (patch) | |
tree | 4d61a4a10f3b96e3bbc20a01f3d597d68b4181e5 /libavcodec/utils.c | |
parent | a5f6720f13c7678c61be1413debf3e11e678781c (diff) | |
parent | 8ac0f6767bf63d3e6b308ee6648ff02598b81e03 (diff) | |
download | ffmpeg-db9f426caba574719c58de12e68742063c8e7979.tar.gz |
Merge commit '8ac0f6767bf63d3e6b308ee6648ff02598b81e03'
* commit '8ac0f6767bf63d3e6b308ee6648ff02598b81e03':
dcadec: allow the decoder to change the channel layout mid-stream
cook: use av_dlog() for debug logging instead of av_log() with AV_LOG_ERROR
cook: move samples_per_frame from COOKSubpacket to where it is used
cook: use av_get_channel_layout_nb_channels() instead of cook_count_channels()
cook: reverse a condition so that the code makes more sense
cook: remove unneeded COOKContext variable, sample_rate
cook: remove unneeded COOKContext variable, bit_rate
cook: use AVCodecContext.channels instead of keeping a private copy
bmvaudio: set channel layout at init() rather than validating it
atrac1: do not keep a copy of channel count in the private context
dsicinaudio: set channels and channel layout
g722dec: set channel layout at initialization instead of validating it
amrwbdec: set channels, channel_layout, and sample_rate
amrnbdec: set channels, channel_layout, and sample_rate
dca_parser: allow the parser to change the sample rate
lavc: check channel count after decoder init
lavc: move SANE_NB_CHANNELS to internal.h and use it in the PCM decoders
Conflicts:
libavcodec/dcadec.c
libavcodec/pcm.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 2cc33ba717..2b7ab46f2a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -907,8 +907,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code if (av_codec_is_decoder(codec)) av_freep(&avctx->subtitle_header); -#define SANE_NB_CHANNELS 128U - if (avctx->channels > SANE_NB_CHANNELS) { + if (avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } @@ -1091,6 +1090,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code avctx->channel_layout = 0; } } + if (avctx->channels && avctx->channels < 0 || + avctx->channels > FF_SANE_NB_CHANNELS) { + ret = AVERROR(EINVAL); + goto free_and_end; + } } end: entangled_thread_counter--; |