History

avformat/iamf_parse: fix parsing AAC DecoderConfigDescriptor

Use ff_mp4_read_descr() to read both the tags and the vlc value that comes after it, which was not being taken into account. Ref: https://github.com/AOMediaCodec/libiamf/issues/119

James Almer committed 2 years ago

Commit 38bcb3b1 parent 9d095f11 file · +7 −10Browse files

Unified · Split

libavformat/iamf_parse.c+7−10
@@ -67,7 +67,7 @@ static int aac_decoder_config(IAMFCodecConfig *codec_config, · 66 unmodified lines
6767 if (codec_config->audio_roll_distance >= 0)
6868 return AVERROR_INVALIDDATA;
6969
70− tag = avio_r8(pb);
70+ ff_mp4_read_descr(logctx, pb, &tag);
7171 if (tag != MP4DecConfigDescrTag)
7272 return AVERROR_INVALIDDATA;
7373
@@ -87,12 +87,9 @@ static int aac_decoder_config(IAMFCodecConfig *codec_config, · 13 unmodified lines
8787 if (codec_id && codec_id != codec_config->codec_id)
8888 return AVERROR_INVALIDDATA;
8989
90− tag = avio_r8(pb);
91− if (tag != MP4DecSpecificDescrTag)
92− return AVERROR_INVALIDDATA;
93−
94− left = len - avio_tell(pb);
95− if (left <= 0)
90+ left = ff_mp4_read_descr(logctx, pb, &tag);
91+ if (tag != MP4DecSpecificDescrTag ||
92+ !left || left > (len - avio_tell(pb)))
9693 return AVERROR_INVALIDDATA;
9794
9895 // We pad extradata here because avpriv_mpeg4audio_get_config2() needs it.
@@ -100,9 +97,9 @@ static int aac_decoder_config(IAMFCodecConfig *codec_config, · 1 unmodified line
10097 if (!codec_config->extradata)
10198 return AVERROR(ENOMEM);
10299
103− codec_config->extradata_size = avio_read(pb, codec_config->extradata, left);
104− if (codec_config->extradata_size < left)
105− return AVERROR_INVALIDDATA;
100+ codec_config->extradata_size = ffio_read_size(pb, codec_config->extradata, left);
101+ if (ret < 0)
102+ return ret;
106103 memset(codec_config->extradata + codec_config->extradata_size, 0,
107104 AV_INPUT_BUFFER_PADDING_SIZE);
108105

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t