diff options
author | wm4 <wm4@nowhere> | 2014-09-26 01:25:48 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-26 01:25:48 +0200 |
commit | fdf40743bcf99d6ce5cc258e59fec30e0cb203e8 (patch) | |
tree | ad036a68cbd1890b7aa32b733d9fe73d3d7adc6d /demux | |
parent | d6c27855d70f3909ea083e03ea51b458f2a35411 (diff) | |
download | mpv-fdf40743bcf99d6ce5cc258e59fec30e0cb203e8.tar.bz2 mpv-fdf40743bcf99d6ce5cc258e59fec30e0cb203e8.tar.xz |
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.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_mkv.c | 10 |
1 files changed, 6 insertions, 4 deletions
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); } |