mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 14:29:25 +08:00
demux_mkv: don't use default_duration for parsed packets
Makes it behave slightly better for VP9. This is also the behavior libavformat has. Also while we're at it, don't set duration except for the first packet. Normally we don't use the duration except for subtitles (which are never parsed or "laced"), so this should make no observable difference.
This commit is contained in:
+6
-4
@@ -2409,14 +2409,16 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
|
||||
dp->keyframe = keyframe;
|
||||
/* If default_duration is 0, assume no pts value is known
|
||||
* for packets after the first one (rather than all pts
|
||||
* values being the same) */
|
||||
if (p == 0 || track->default_duration)
|
||||
* values being the same). Also, don't use it for extra
|
||||
* packets resulting from parsing. */
|
||||
if (p == 0 || (p == i && track->default_duration))
|
||||
dp->pts = mkv_d->last_pts + p * track->default_duration;
|
||||
p++;
|
||||
if (track->ms_compat)
|
||||
MPSWAP(double, dp->pts, dp->dts);
|
||||
dp->duration = block_duration / 1e9;
|
||||
if (p == 0)
|
||||
dp->duration = block_duration / 1e9;
|
||||
demux_add_packet(stream, dp);
|
||||
p++;
|
||||
}
|
||||
talloc_free_children(track->parser_tmp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user