From fdf40743bcf99d6ce5cc258e59fec30e0cb203e8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 26 Sep 2014 01:25:48 +0200 Subject: 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. --- demux/demux_mkv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'demux/demux_mkv.c') diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index c5a24bb190..8c00a8fe8f 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -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); } -- cgit v1.2.3