[vlc-commits] demux: ps: check for discontinuities

Francois Cartegnie git at videolan.org
Tue Apr 17 14:02:24 CEST 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Apr 16 12:26:56 2018 +0200| [44033fe4b000656d6cd46ae2f27f2c6cde2f30d2] | committer: Hugo Beauzée-Luyssen

demux: ps: check for discontinuities

(cherry picked from commit a67c43c405f9c1d5fac1d1351214114d21f3e4bb)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/demux/mpeg/ps.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index e6c5ab1da9..71a94ec8e0 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -392,6 +392,13 @@ static void NotifyDiscontinuity( ps_track_t *p_tk, es_out_t *out )
     }
 }
 
+static void CheckPCR( demux_sys_t *p_sys, es_out_t *out, mtime_t i_scr )
+{
+    if( p_sys->i_scr > VLC_TS_INVALID &&
+        llabs( p_sys->i_scr - i_scr ) > CLOCK_FREQ )
+        NotifyDiscontinuity( p_sys->tk, out );
+}
+
 /*****************************************************************************
  * Demux:
  *****************************************************************************/
@@ -451,6 +458,7 @@ static int Demux( demux_t *p_demux )
         {
             if( p_sys->i_first_scr == -1 )
                 p_sys->i_first_scr = p_sys->i_pack_scr;
+            CheckPCR( p_sys, p_demux->out, p_sys->i_pack_scr );
             p_sys->i_scr = p_sys->i_pack_scr;
             p_sys->i_lastpack_byte = vlc_stream_Tell( p_demux->s );
             if( !p_sys->b_have_pack ) p_sys->b_have_pack = true;
@@ -603,6 +611,7 @@ static int Demux( demux_t *p_demux )
                 {
                     /* A hack to sync the A/V on PES files. */
                     msg_Dbg( p_demux, "force SCR: %"PRId64, p_pkt->i_pts );
+                    CheckPCR( p_sys, p_demux->out, p_pkt->i_pts );
                     p_sys->i_scr = p_pkt->i_pts;
                     if( p_sys->i_first_scr == -1 )
                         p_sys->i_first_scr = p_sys->i_scr;



More information about the vlc-commits mailing list