From cc21eadf30aa3e822be25ffd5118d781f4409c86 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 23 Apr 2015 20:16:33 +0200 Subject: demux_mkv: limit timestamp fixing to 1ms max And also fix the description. It didn't actually reflect what the code did. --- DOCS/man/options.rst | 12 ++++++------ demux/demux_mkv.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 47f4c15152..b9c423e053 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -2116,13 +2116,13 @@ Demuxer Fix rounded Matroska timestamps (enabled by default). Matroska usually stores timestamps rounded to milliseconds. This means timestamps jitter by some amount around the intended timestamp. mpv can correct the timestamps - based on the framerate value stored in the file: if the timestamps does - not deviate more than 1 frame (as implied by the framerate), the timestamp - is rounded to the next frame, which should undo the rounding the muxer - did. + based on the framerate value stored in the file: the timestamp is rounded + to the next frame (according to the framerate), unless the new timestamp + would deviate more than 1ms from the old one. This should undo the rounding + done by the muxer. - This can break playback if the framerate value stored in the file is too - high. + (The allowed deviation can be less than 1ms if the file uses a non-standard + timecode scale.) ``--demuxer-rawaudio-channels=`` Number of channels (or channel layout) if ``--demuxer=rawaudio`` is used diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 39b271e1b6..b4ae042feb 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -2336,7 +2336,7 @@ static double fix_timestamp(demuxer_t *demuxer, mkv_track_t *track, double ts) mkv_demuxer_t *mkv_d = demuxer->priv; if (demuxer->opts->demux_mkv->fix_timestamps && track->default_duration > 0) { // Assume that timestamps have been rounded to the timecode scale. - double quant = mkv_d->tc_scale / 1e9; + double quant = MPMIN(mkv_d->tc_scale / 1e9, 0.001); double rts = rint(ts / track->default_duration) * track->default_duration; if (fabs(rts - ts) < quant) ts = rts; -- cgit v1.2.3