oggvorbis: fix the first 2 packets timestamps matching issue
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 5 May 2012 08:48:08 +0000 (10:48 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 5 May 2012 08:57:53 +0000 (10:57 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/oggparsevorbis.c

index fa03ed7..28de6bd 100644 (file)
@@ -323,9 +323,9 @@ static int vorbis_packet(AVFormatContext *s, int idx)
             }
             next_pkt += os->segments[seg];
         }
-        os->lastpts = os->lastdts   = os->granule - FFMIN(duration, os->granule);
+        os->lastpts = os->lastdts   = os->granule - duration;
         if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
-            s->streams[idx]->start_time = os->lastpts;
+            s->streams[idx]->start_time = FFMAX(os->lastpts, 0);
             if (s->streams[idx]->duration)
                 s->streams[idx]->duration -= s->streams[idx]->start_time;
         }