[FFmpeg-devel] [PATCH 1/5] avcodec/adpcm_ima_amv: restrict to 1 channel

Zane van Iperen zane at zanevaniperen.com
Mon Nov 2 12:02:23 EET 2020



On 2/11/20 7:48 pm, Andreas Rheinhardt wrote:
> 
> Zane van Iperen:
>> The format doesn't allow for anything else.
>>
>> Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
>> ---
>>   libavcodec/adpcm.c | 5 ++++-
>>   libavcodec/utils.c | 2 +-
>>   2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
>> index 701b125c47..d34fd6c6e1 100644
>> --- a/libavcodec/adpcm.c
>> +++ b/libavcodec/adpcm.c
>> @@ -110,6 +110,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
>>       unsigned int max_channels = 2;
>>
>>       switch(avctx->codec->id) {
>> +    case AV_CODEC_ID_ADPCM_IMA_AMV:
>>       case AV_CODEC_ID_ADPCM_IMA_CUNNING:
>>           max_channels = 1;
>>           break;
>> @@ -1684,6 +1685,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
>>           }
>>           break;
>>       case AV_CODEC_ID_ADPCM_IMA_AMV:
>> +        av_assert0(avctx->channels == 1);
>> +
> 
> Which check ensures that this assert won't be triggered?
> 

At the very top of the patch, just above "case 
AV_CODEC_ID_ADPCM_IMA_CUNNING:".
max_channels is set to 1, so it'll bail before it gets to the assert.




More information about the ffmpeg-devel mailing list