From a9ee86e79b767d29362986ced0ec95d4de2b3eb1 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Date: Sun, 25 May 2008 01:22:06 +0000
Subject: [PATCH] set correct duration when using b frames

Originally committed as revision 13372 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavformat/flvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 1a781f4b922..f537a9c4ebd 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -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;
-- 
GitLab