lavf/compute_pkt_fields: only run pts by duration correction if reference ts is available
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 14 Sep 2012 17:46:44 +0000 (19:46 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 14 Sep 2012 17:47:41 +0000 (19:47 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index 7527784..c6a9e58 100644 (file)
@@ -1114,7 +1114,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
                    pkt->duration                ) {
             int duration = pkt->duration;
 
-            if(pkt->pts != AV_NOPTS_VALUE && duration){
+            if(st->cur_dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && duration){
                 int64_t old_diff= FFABS(st->cur_dts - duration - pkt->pts);
                 int64_t new_diff= FFABS(st->cur_dts - pkt->pts);
                 if(   old_diff < new_diff && old_diff < (duration>>3)