[FFmpeg-cvslog] ffplay: add delay multiple times to frame_timer if it is less than current time

Marton Balint git at videolan.org
Sun Oct 16 23:53:14 CEST 2011


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Oct  9 16:52:28 2011 +0200| [abb0e4f63772fe96f5e221b8a579180cb4ebe5a9] | committer: Marton Balint

ffplay: add delay multiple times to frame_timer if it is less than current time

If the picture queue is empty, or when the calculated delay is 0, frame_timer
is not increased but we are still displaying the old frame. When we eventually
get a frame, where the computed delay is positive, so we don't need to drop any
more frames, then it is best to update frame_timer to be as near as the current
time as it can.

This way we dont't have to wait several frames to add the necesarry delays to
frame_timer to reach current time, therefore there are no extra frame drops
after reaching a positive delay.

Signed-off-by: Marton Balint <cus at passwd.hu>

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

 ffplay.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 58ed5b8..a0c8487 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1142,7 +1142,8 @@ retry:
                 return;
 
             is->frame_last_pts = vp->pts;
-            is->frame_timer += delay;
+            if (delay > 0)
+                is->frame_timer += delay * FFMAX(1, floor((time-is->frame_timer) / delay));
 
             /* update current video pts */
             is->video_current_pts = vp->pts;



More information about the ffmpeg-cvslog mailing list