Skip to content

Commit

Permalink
lavf/utils: Try to unwrap pts/dts so as to minimize wraps
Browse files Browse the repository at this point in the history
Based on code by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information
michaelni committed Aug 24, 2012
1 parent 254917f commit 12b1512
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libavformat/utils.c
Expand Up @@ -1021,7 +1021,10 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
presentation_delayed = 1;

if(pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && pkt->dts - (1LL<<(st->pts_wrap_bits-1)) > pkt->pts && st->pts_wrap_bits<63){
pkt->dts -= 1LL<<st->pts_wrap_bits;
if(is_relative(st->cur_dts) || pkt->dts - (1LL<<(st->pts_wrap_bits-1)) > st->cur_dts) {
pkt->dts -= 1LL<<st->pts_wrap_bits;
} else
pkt->pts += 1LL<<st->pts_wrap_bits;
}

// some mpeg2 in mpeg-ps lack dts (issue171 / input_file.mpg)
Expand Down

0 comments on commit 12b1512

Please sign in to comment.