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:
wm4 2014-09-26 01:25:48 +02:00
parent d6c27855d7
commit fdf40743bc
1 changed files with 6 additions and 4 deletions

View File

@ -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);
if (p == 0)
dp->duration = block_duration / 1e9;
demux_add_packet(stream, dp);
p++;
}
talloc_free_children(track->parser_tmp);
}