From fd095539d10bb440042e671f95306b16b0fec674 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Fri, 21 Oct 2011 17:25:30 +0200 Subject: 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. --- libavcodec/mpeg4audio.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libavcodec/mpeg4audio.h') diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index d6730b97b3..7560f3f4e4 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -42,14 +42,17 @@ typedef struct { extern const int avpriv_mpeg4audio_sample_rates[16]; extern const uint8_t ff_mpeg4audio_channels[8]; + /** * Parse MPEG-4 systems extradata to retrieve audio configuration. * @param[in] c MPEG4AudioConfig structure to fill. * @param[in] buf Extradata from container. - * @param[in] buf_size Extradata size. + * @param[in] bit_size Extradata size in bits. + * @param[in] sync_extension look for a sync extension after config if true. * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata. */ -int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size); +int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, + int bit_size, int sync_extension); enum AudioObjectType { AOT_NULL, -- cgit v1.2.3