set correct duration when using b frames
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>
Sun, 25 May 2008 01:22:06 +0000 (01:22 +0000)
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>
Sun, 25 May 2008 01:22:06 +0000 (01:22 +0000)
Originally committed as revision 13372 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/flvenc.c

index 1a781f4b922746f58fe47bfb10fecdf2806622d1..f537a9c4ebd5b65ca13d43eb30ab6badafacbe59 100644 (file)
@@ -306,7 +306,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
         put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0);
     put_buffer(pb, pkt->data, size);
     put_be32(pb,size+flags_size+11); // previous tag size
-    flv->duration = pkt->pts + pkt->duration;
+    flv->duration = FFMAX(flv->duration, pkt->pts + pkt->duration);
 
     put_flush_packet(pb);
     return 0;