[FFmpeg-devel] [RFC][PATCH]lavf/matroskaenc: Assume 48kHz sample rate for Opus initial padding.

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Jan 5 13:23:54 CET 2016


Hi!

Attached patch may fix this issue reported for Firefox:
https://bugzilla.mozilla.org/show_bug.cgi?id=1227153
Completely untested but I believe the patch matches a 
comment in libopusenc.c line 90.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 98ab6df..f7fb5c3 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -924,7 +924,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
 
     if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->initial_padding && codec->codec_id == AV_CODEC_ID_OPUS) {
         int64_t codecdelay = av_rescale_q(codec->initial_padding,
-                                          (AVRational){ 1, codec->sample_rate },
+                                          (AVRational){ 1, 48000 },
                                           (AVRational){ 1, 1000000000 });
         if (codecdelay < 0) {
             av_log(s, AV_LOG_ERROR, "Initial padding is invalid\n");


More information about the ffmpeg-devel mailing list