Browse code

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@passwd.hu>

Marton Balint authored on 2011/10/09 23:52:28
Showing 1 changed files
... ...
@@ -1142,7 +1142,8 @@ retry:
1142 1142
                 return;
1143 1143
 
1144 1144
             is->frame_last_pts = vp->pts;
1145
-            is->frame_timer += delay;
1145
+            if (delay > 0)
1146
+                is->frame_timer += delay * FFMAX(1, floor((time-is->frame_timer) / delay));
1146 1147
 
1147 1148
             /* update current video pts */
1148 1149
             is->video_current_pts = vp->pts;