[FFmpeg-cvslog] ffmpeg: Check duration for overlap and clip in fps cfr/vfr code

Michael Niedermayer git at videolan.org
Wed Nov 19 18:40:43 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 19 17:21:04 2014 +0100| [4e20e94921460f7108ad76dc873417cd15b356c4] | committer: Michael Niedermayer

ffmpeg: Check duration for overlap and clip in fps cfr/vfr code

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

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

 ffmpeg.c                            |    7 +++++++
 tests/ref/fate/gif-disposal-restore |    2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 3b24cf9..e51e789 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -904,6 +904,13 @@ static void do_video_out(AVFormatContext *s,
     sync_ipts = next_picture->pts;
     delta0 = sync_ipts - ost->sync_opts;
     delta  = delta0 + duration;
+    if (delta0 < 0 && delta > 0) {
+        double cor = FFMIN(-delta0, duration);
+        av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", -delta0);
+        sync_ipts += cor;
+        duration -= cor;
+        delta0 += cor;
+    }
 
     /* by default, we output a single frame */
     nb0_frames = 0;
diff --git a/tests/ref/fate/gif-disposal-restore b/tests/ref/fate/gif-disposal-restore
index c0c04b4..0ff1715 100644
--- a/tests/ref/fate/gif-disposal-restore
+++ b/tests/ref/fate/gif-disposal-restore
@@ -1,4 +1,4 @@
 #tb 0: 1/1
 0,          0,          0,        1,   112320, 0xb8afe429
-0,          0,          0,        1,   112320, 0xae588a4b
+0,          1,          1,        1,   112320, 0xae588a4b
 0,          3,          3,        1,   112320, 0xccdd27b7



More information about the ffmpeg-cvslog mailing list