demux_mkv: limit timestamp fixing to 1ms max

And also fix the description. It didn't actually reflect what the code
did.
This commit is contained in:
wm4 2015-04-23 20:16:33 +02:00
parent 90d7e51643
commit cc21eadf30
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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;