[FFmpeg-devel] [PATCH] Revert "matroskaenc: refuse to write AAC without valid extradata"

Vittorio Gambaletta ffmpeg-dev at vittgam.net
Sun Sep 20 20:13:51 CEST 2015


The patch created problems when remuxing TS files that contain AAC audio to Matroska.

Fixes: 51da7d02748c ("matroskaenc: refuse to write AAC without valid extradata")
Signed-off-by: Vittorio Gambaletta <ffmpeg-dev at vittgam.net>

diff a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -604,21 +604,20 @@
     return 0;
 }
 
-static int get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec,
-                                int *sample_rate, int *output_sample_rate)
+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,
+        av_log(s, AV_LOG_WARNING,
                "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,
@@ -858,11 +857,8 @@
     if (!bit_depth)
         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;
-    }
+    if (codec->codec_id == AV_CODEC_ID_AAC)
+        get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);
 
     track = start_ebml_master(pb, MATROSKA_ID_TRACKENTRY, 0);
     put_ebml_uint (pb, MATROSKA_ID_TRACKNUMBER,



More information about the ffmpeg-devel mailing list