[vlc-devel] commit: Improved late values after pts_delay changes in clock.c. ( Laurent Aimar )

git version control git at videolan.org
Fri Oct 23 23:14:52 CEST 2009


vlc | branch: 1.0-bugfix | Laurent Aimar <fenrir at videolan.org> | Fri Jul 17 18:47:01 2009 +0200| [4798224756335167c6b8e803db040e656edc1f9e] | committer: Laurent Aimar 

Improved late values after pts_delay changes in clock.c.
(cherry picked from commit 3c84b6ca4ced1aad7549e30261fbe3348c529c15)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4798224756335167c6b8e803db040e656edc1f9e
---

 src/input/clock.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/input/clock.c b/src/input/clock.c
index 9608546..59aa848 100644
--- a/src/input/clock.c
+++ b/src/input/clock.c
@@ -460,10 +460,20 @@ void input_clock_SetJitter( input_clock_t *cl,
 
     /* Update late observations */
     const mtime_t i_delay_delta = i_pts_delay - cl->i_pts_delay;
+    mtime_t pi_late[INPUT_CLOCK_LATE_COUNT];
+    for( int i = 0; i < INPUT_CLOCK_LATE_COUNT; i++ )
+        pi_late[i] = __MAX( cl->late.pi_value[(cl->late.i_index + 1 + i)%INPUT_CLOCK_LATE_COUNT] - i_delay_delta, 0 );
+
+    for( int i = 0; i < INPUT_CLOCK_LATE_COUNT; i++ )
+        cl->late.pi_value[i] = 0;
+    cl->late.i_index = 0;
+
     for( int i = 0; i < INPUT_CLOCK_LATE_COUNT; i++ )
     {
-        if( cl->late.pi_value[i] > 0 )
-            cl->late.pi_value[i] = __MAX( cl->late.pi_value[i] - i_delay_delta, 0 );
+        if( pi_late[i] <= 0 )
+            continue;
+        cl->late.pi_value[cl->late.i_index] = pi_late[i];
+        cl->late.i_index = ( cl->late.i_index + 1 ) % INPUT_CLOCK_LATE_COUNT;
     }
 
     /* TODO always save the value, and when rebuffering use the new one if smaller




More information about the vlc-devel mailing list