[FFmpeg-cvslog] lavf: fix update_initial_durations() so it handles missing durations with the initial timestamp being known.

Michael Niedermayer git at videolan.org
Fri Mar 2 06:41:45 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Mar  2 06:22:20 2012 +0100| [0b90db01b5277fdcf3a524ce481469deda202059] | committer: Michael Niedermayer

lavf: fix update_initial_durations() so it handles missing durations with the initial timestamp being known.

This fixes duplicate timestamps on mp2 in ts with non seekable input.
It also fixed the fate pva demux timestamps.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b90db01b5277fdcf3a524ce481469deda202059
---

 libavformat/utils.c      |    6 +++---
 tests/ref/fate/pva-demux |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index e84cd76..580b9fe 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -902,17 +902,17 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st, AVPacket
     for(; pktl; pktl= pktl->next){
         if(pktl->pkt.stream_index != pkt->stream_index)
             continue;
-        if(pktl->pkt.pts == pktl->pkt.dts && pktl->pkt.dts == AV_NOPTS_VALUE
+        if(pktl->pkt.pts == pktl->pkt.dts && (pktl->pkt.dts == AV_NOPTS_VALUE || pktl->pkt.dts == st->first_dts)
            && !pktl->pkt.duration){
             pktl->pkt.dts= cur_dts;
             if(!st->codec->has_b_frames)
                 pktl->pkt.pts= cur_dts;
-            cur_dts += pkt->duration;
             pktl->pkt.duration= pkt->duration;
         }else
             break;
+        cur_dts = pktl->pkt.dts + pktl->pkt.duration;
     }
-    if(st->first_dts == AV_NOPTS_VALUE)
+    if(!pktl)
         st->cur_dts= cur_dts;
 }
 
diff --git a/tests/ref/fate/pva-demux b/tests/ref/fate/pva-demux
index 5227b5b..67d4844 100644
--- a/tests/ref/fate/pva-demux
+++ b/tests/ref/fate/pva-demux
@@ -1,9 +1,9 @@
 #tb 0: 1/25
 #tb 1: 1/90000
 1,          0,          0,     2160,      384, 0x071abcc8
-1,          0,          0,     2160,      384, 0x31c9aee0
-1,       2160,       2160,     2160,      384, 0xa50eaa94
-1,       4320,       4320,     2160,      384, 0x9e86ba0e
+1,       2160,       2160,     2160,      384, 0x31c9aee0
+1,       4320,       4320,     2160,      384, 0xa50eaa94
+1,       6480,       6480,     2160,      384, 0x9e86ba0e
 1,       8640,       8640,     2160,      384, 0x2321b800
 1,      10800,      10800,     2160,      384, 0x2347afa8
 1,      12960,      12960,     2160,      384, 0x0831b8d3



More information about the ffmpeg-cvslog mailing list