[vlc-commits] access: live555: use local offset on forward clock sync

Francois Cartegnie git at videolan.org
Fri Aug 12 20:37:59 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Aug 12 19:21:01 2016 +0200| [c8ee8ea5065bb1ae08f42bed6bd5e90e009dc8da] | committer: Francois Cartegnie

access: live555: use local offset on forward clock sync

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

 modules/access/live555.cpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 1367b8c..a609ce2 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -174,6 +174,7 @@ typedef struct
     char            waiting;
     int64_t         i_lastpts;
     int64_t         i_pcr;
+    int64_t         i_offset;
     double          f_npt;
 
     bool            b_selected;
@@ -1364,6 +1365,7 @@ static int Demux( demux_t *p_demux )
             {
                 live_track_t *tk = p_sys->track[i];
                 tk->i_lastpts = VLC_TS_INVALID;
+                tk->i_offset = 0;
                 tk->i_pcr = VLC_TS_INVALID;
                 tk->f_npt = 0.;
                 tk->b_discontinuity = false;
@@ -2012,10 +2014,19 @@ static void StreamRead( void *p_private, unsigned int i_size,
     {
         msg_Dbg( p_demux, "tk->rtpSource->hasBeenSynchronizedUsingRTCP()" );
         p_sys->b_rtcp_sync = tk->b_rtcp_sync = true;
-        tk->b_discontinuity = ( tk->i_pcr > VLC_TS_INVALID );
-        tk->i_pcr = VLC_TS_INVALID;
+        if( tk->i_pcr < i_pts )
+        {
+            tk->i_offset = (tk->i_pcr > 0) ? i_pts + tk->i_pcr : 0;
+        }
+        else
+        {
+            tk->b_discontinuity = ( tk->i_pcr > VLC_TS_INVALID );
+            tk->i_pcr = VLC_TS_INVALID;
+        }
     }
 
+    i_pts -= tk->i_offset;
+
     /* Update our global npt value */
     if( tk->f_npt > 0 &&
         ( tk->f_npt < p_sys->f_npt_length || p_sys->f_npt_length <= 0 ) )



More information about the vlc-commits mailing list