1
mirror of https://github.com/mpv-player/mpv synced 2024-11-18 21:16:10 +01:00
mpv/demux
wm4 77a00e444f demux_mkv: ignore DefaultDuration in some cases
This fixes playback of the sample linked by FFmpeg ticket 2508. The fix
follows ffmpeg commit 6158a3b (although it's not exactly the same).

The problem here is that the file contains an apparently non-sense
DefaultDuration value. DefaultDuration for audio tracks is used to
derive PTS values for packets with no timestamps, like they can happen
with frames inside a laced block. So the first packet of a SimpleBlock
will have a correct PTS, while the PTS values of the following packets
are calculated using DefaultDuration, and thus are broken.

This leads to seemingly ok playback, but broken A/V sync. Not using the
DefaultDuration value will leave the PTS values of these packets unset,
and the audio decoder can derive them from the output instead.

The fix more or less uses a heuristic to detect the broken case: if the
sample rate is 8 KHz (Matroska default, can assume unset), and the codec
is AC3 (as the broken file did), don't use it. I'm not sure why this
should be done only for AC3, maybe the muxing application (mkvmerge
v4.9.1) has known issues with AC3. AC3 also doesn't support 8 KHz as
sample rate natively.

(By the way, I'm not sure why we should honor the DefaultDuration at all
for audio. It doesn't seem to be needed. You can't seek to these frames,
and decoders should always be able to produce perfect PTS values by
adding the duration of the decoded audio to the first PTS.)
2013-07-16 22:59:55 +02:00
..
codec_tags.c demux: fix big endian PCM in mkv with demux_mkv 2013-05-11 20:19:08 +02:00
codec_tags.h core: redo how codecs are mapped, remove codecs.conf 2013-02-10 17:25:56 +01:00
demux_cue.c demux: remove useless author/comment fields 2013-07-12 22:16:27 +02:00
demux_edl.c demux: remove useless author/comment fields 2013-07-12 22:16:27 +02:00
demux_lavf.c demux_lavf: add terrible hack to make DVD playback just work 2013-07-14 23:44:50 +02:00
demux_libass.c demux: remove useless author/comment fields 2013-07-12 22:16:27 +02:00
demux_mf.c demux: assume correct-pts mode by default 2013-07-12 22:16:27 +02:00
demux_mkv.c demux_mkv: ignore DefaultDuration in some cases 2013-07-16 22:59:55 +02:00
demux_mng.c demux: make claiming accurate seek the default 2013-07-12 22:29:34 +02:00
demux_packet.h demux: workaround for -demuxer mpegts -correct-pts 2013-05-21 22:07:13 +02:00
demux_raw.c demux_raw: uncrustify 2013-07-14 17:55:54 +02:00
demux_subreader.c demux_subreader: make clang happy to fix warning 2013-07-15 21:28:58 +02:00
demux.c demux: make claiming accurate seek the default 2013-07-12 22:29:34 +02:00
demux.h demux: assume correct-pts mode by default 2013-07-12 22:16:27 +02:00
ebml.c stream: fix some aspects of EOF handling 2013-06-16 22:05:10 +02:00
ebml.h demux_mkv: use a bounded buffer for block data 2013-04-20 23:28:22 +02:00
matroska.h demux_mkv: support dirac in mkv 2013-05-21 22:07:12 +02:00
mf.c demux_mf: fix crashes when '*' matches directories 2013-03-19 01:54:45 +01:00
mf.h demux_mf: allow displaying single image files, various cleanups 2012-11-16 21:21:16 +01:00
ms_hdr.h ms_hdr: remove unused definitions 2013-07-10 02:00:47 +02:00
stheader.h demux_mkv: never force output sample rate 2013-07-16 22:44:15 +02:00