summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-06-06 01:14:11 -0300
committerJames Almer <jamrial@gmail.com>2016-06-07 20:32:25 -0300
commit49b024663501320310ec729f3bd15d0420bd9e59 (patch)
tree11053235fd367d7b28e63f8c79c4486a32e3ac4c /libavformat/matroskadec.c
parent27c1eae55f24e9ed005a6634cd4ddd867118fa48 (diff)
avformat/matroskadec: force 48kHz sample rate when rescaling Opus inital padding
Mkvtoolnix stores the sample rate of the original stream as reported by the "OpusHead" stream header instead of 48kHz, the actual sample rate of the Opus stream. Ignoring the stored sample rate and forcing 48kHz preserves the correct initial padding when remuxing such files. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3270009409..7880a103cb 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2353,7 +2353,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
if (track->codec_delay > 0) {
st->codecpar->initial_padding = av_rescale_q(track->codec_delay,
(AVRational){1, 1000000000},
- (AVRational){1, st->codecpar->sample_rate});
+ (AVRational){1, st->codecpar->codec_id == AV_CODEC_ID_OPUS ?
+ 48000 : st->codecpar->sample_rate});
}
if (track->seek_preroll > 0) {
st->codecpar->seek_preroll = av_rescale_q(track->seek_preroll,