From 1107a070e4f2a37fe59552d3c82b08e7aa522e1f Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 30 Mar 2016 11:34:35 +0200 Subject: Revert "demux_mkv: don't trust DefaultDuration for audio" This reverts commit 503c6f7fd6c3c542667c93c75db260671c4ba982. There are situations where some decoders (MF apparently) always require a timestamp. Also, this makes bitrate estimation more granular than necessary. It seems it's better to try to detect fiels with broken default durations explicitly instead. Or maybe something should be added to smooth audio timestamps after filters. --- demux/demux_mkv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'demux') diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 5e6de8619d..b0a910bf68 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -1687,9 +1687,11 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track) sh_a->samplerate = 48000; } - // This field tends to be broken, and our decoder can interpolate the - // missing timestamps anyway. - track->default_duration = 0; + // Some files have broken default DefaultDuration set, which will lead to + // audio packets with incorrect timestamps. This follows FFmpeg commit + // 6158a3b, sample see FFmpeg ticket 2508. + if (sh_a->samplerate == 8000 && strcmp(codec, "ac3") == 0) + track->default_duration = 0; sh_a->extradata = extradata; sh_a->extradata_size = extradata_len; -- cgit v1.2.3