summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-23 20:16:33 +0200
committerwm4 <wm4@nowhere>2015-04-23 20:17:43 +0200
commitcc21eadf30aa3e822be25ffd5118d781f4409c86 (patch)
tree6214f4f27211b165cb9ac32a44c2717af6725203
parent90d7e51643273a14dfb9a4db622abb7da4e0aa5f (diff)
downloadmpv-cc21eadf30aa3e822be25ffd5118d781f4409c86.tar.bz2
mpv-cc21eadf30aa3e822be25ffd5118d781f4409c86.tar.xz
demux_mkv: limit timestamp fixing to 1ms max
And also fix the description. It didn't actually reflect what the code did.
-rw-r--r--DOCS/man/options.rst12
-rw-r--r--demux/demux_mkv.c2
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=<value>``
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;