[FFmpeg-devel] [PATCH]lavf/mkv: Fix AAC remuxing
Carl Eugen Hoyos
cehoyos at ag.or.at
Wed Apr 1 13:55:57 CEST 2015
Hi!
Attached patch fixes a user-reported regression when
remuxing some streams containing aac to mkv.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 6b2e390..a03da14 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -572,21 +572,18 @@ static int put_flac_codecpriv(AVFormatContext *s,
return 0;
}
-static int get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec,
+static void 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_ERROR,
- "Error parsing AAC extradata, unable to determine samplerate.\n");
- return AVERROR(EINVAL);
+ return;
}
*sample_rate = mp4ac.sample_rate;
*output_sample_rate = mp4ac.ext_sample_rate;
- return 0;
}
static int mkv_write_native_codecprivate(AVFormatContext *s,
@@ -827,9 +824,11 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
bit_depth = codec->bits_per_coded_sample;
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;
+ get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);
+ if (!sample_rate) {
+ av_log(s, AV_LOG_ERROR, "AAC samplerate unknown\n");
+ return AVERROR(EINVAL);
+ }
}
track = start_ebml_master(pb, MATROSKA_ID_TRACKENTRY, 0);
More information about the ffmpeg-devel
mailing list