changeset 618:65787cd808e4 libavformat

workaround some broken mpeg-ps timestamps
author michael
date Wed, 15 Dec 2004 02:36:03 +0000
parents 1ca4877e42f3
children 7d50b0a324ea
files utils.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Tue Dec 14 16:19:26 2004 +0000
+++ b/utils.c	Wed Dec 15 02:36:03 2004 +0000
@@ -741,6 +741,14 @@
         /* cannot compute PTS if not present (we can compute it only
            by knowing the futur */
     } else {
+        if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){
+            int64_t old_diff= ABS(st->cur_dts - pkt->duration - pkt->pts);
+            int64_t new_diff= ABS(st->cur_dts - pkt->pts);
+            if(old_diff < new_diff && old_diff < (pkt->duration>>3)){
+                pkt->pts += pkt->duration;
+            }
+        }
+    
         /* presentation is not delayed : PTS and DTS are the same */
         if (pkt->pts == AV_NOPTS_VALUE) {
             if (pkt->dts == AV_NOPTS_VALUE) {