aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2011-10-21 17:25:30 +0200
committerJanne Grunau <janne-libav@jannau.net>2011-12-03 00:42:48 +0100
commitfd095539d10bb440042e671f95306b16b0fec674 (patch)
treec28e329a98879823371f7b3e3f388f83f3805fab /libavformat
parent0eea212943544d40f99b05571aa7159d78667154 (diff)
downloadffmpeg-fd095539d10bb440042e671f95306b16b0fec674.tar.gz
latmdec: fix audio specific config parsing
Pass the correct size in bits to mpeg4audio_get_config and add a flag to disable parsing of the sync extension when the size is not known. Latm with AudioMuxVersion 0 does not specify the size of the audio specific config. Data after the audio specific config can be misinterpreted as sync extension resulting in random and wrong configs.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/adtsenc.c2
-rw-r--r--libavformat/flvdec.c2
-rw-r--r--libavformat/isom.c2
-rw-r--r--libavformat/latmenc.c2
-rw-r--r--libavformat/matroskaenc.c3
5 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 55fece5dd6..ef3d8e2c21 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -37,7 +37,7 @@ int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf
int off;
init_get_bits(&gb, buf, size * 8);
- off = avpriv_mpeg4audio_get_config(&m4ac, buf, size);
+ off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
if (off < 0)
return off;
skip_bits_long(&gb, off);
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 5d19dd8413..51a8126904 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -534,7 +534,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (st->codec->codec_id == CODEC_ID_AAC) {
MPEG4AudioConfig cfg;
avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
- st->codec->extradata_size);
+ st->codec->extradata_size * 8, 1);
st->codec->channels = cfg.channels;
if (cfg.ext_sample_rate)
st->codec->sample_rate = cfg.ext_sample_rate;
diff --git a/libavformat/isom.c b/libavformat/isom.c
index b0eef375c6..7b9f91b58a 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -436,7 +436,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
if (st->codec->codec_id == CODEC_ID_AAC) {
MPEG4AudioConfig cfg;
avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
- st->codec->extradata_size);
+ st->codec->extradata_size * 8, 1);
st->codec->channels = cfg.channels;
if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
st->codec->sample_rate = avpriv_mpa_freq_tab[cfg.sampling_index];
diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
index 679f2cc9c6..423710ddea 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -54,7 +54,7 @@ static int latm_decode_extradata(LATMContext *ctx, uint8_t *buf, int size)
MPEG4AudioConfig m4ac;
init_get_bits(&gb, buf, size * 8);
- ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size);
+ ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
if (ctx->off < 0)
return ctx->off;
skip_bits_long(&gb, ctx->off);
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index b8c73bf950..9f8d5d853b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -448,7 +448,8 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int
{
MPEG4AudioConfig mp4ac;
- if (avpriv_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) {
+ if (avpriv_mpeg4audio_get_config(&mp4ac, codec->extradata,
+ codec->extradata_size * 8, 1) < 0) {
av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n");
return;
}