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

git version control git at videolan.org
Fri Jul 17 18:48:58 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Jul 17 18:47:01 2009 +0200| [3c84b6ca4ced1aad7549e30261fbe3348c529c15] | committer: Laurent Aimar 

Improved late values after pts_delay changes in clock.c.

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

 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 a797299..811ec7a 100644
--- a/src/input/clock.c
+++ b/src/input/clock.c
@@ -501,10 +501,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