aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-01-01 18:22:46 +0100
committerAnton Khirnov <anton@khirnov.net>2015-01-09 15:51:00 +0100
commit51da7d02748cc54b7d009115e76efa940b99a8ef (patch)
tree6f9de101d55575fae8abe2a73fb1f7fe651663bb
parent7e4e010b80e76862e83afbd41c25d50e72f0b44c (diff)
downloadffmpeg-51da7d02748cc54b7d009115e76efa940b99a8ef.tar.gz
matroskaenc: refuse to write AAC without valid extradata
-rw-r--r--libavformat/matroskaenc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1d55b6629a..3427c5987f 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -520,20 +520,21 @@ static int put_flac_codecpriv(AVFormatContext *s,
return 0;
}
-static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec,
- int *sample_rate, int *output_sample_rate)
+static int get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec,
+ int *sample_rate, int *output_sample_rate)
{
MPEG4AudioConfig mp4ac;
if (avpriv_mpeg4audio_get_config(&mp4ac, codec->extradata,
codec->extradata_size * 8, 1) < 0) {
- av_log(s, AV_LOG_WARNING,
+ av_log(s, AV_LOG_ERROR,
"Error parsing AAC extradata, unable to determine samplerate.\n");
- return;
+ return AVERROR(EINVAL);
}
*sample_rate = mp4ac.sample_rate;
*output_sample_rate = mp4ac.ext_sample_rate;
+ return 0;
}
static int mkv_write_native_codecprivate(AVFormatContext *s,
@@ -748,8 +749,11 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
if (!bit_depth)
bit_depth = av_get_bytes_per_sample(codec->sample_fmt) << 3;
- if (codec->codec_id == AV_CODEC_ID_AAC)
- get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);
+ if (codec->codec_id == AV_CODEC_ID_AAC) {
+ ret = get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);
+ if (ret < 0)
+ return ret;
+ }
track = start_ebml_master(pb, MATROSKA_ID_TRACKENTRY, 0);
put_ebml_uint (pb, MATROSKA_ID_TRACKNUMBER , i + 1);