]> git.sesse.net Git - vlc/commitdiff
* modules/demux/ps.c: backport of 13156.
authorGildas Bazin <gbazin@videolan.org>
Thu, 10 Nov 2005 19:23:12 +0000 (19:23 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 10 Nov 2005 19:23:12 +0000 (19:23 +0000)
modules/demux/ps.c

index 22587db2d3f2b1a0eda0fbece541bc12f5e330e4..da61b1284db382cccade30f66011d77e39b46ad0 100644 (file)
@@ -68,6 +68,8 @@ struct demux_sys_t
 
     int64_t     i_scr;
     int         i_mux_rate;
+
+    vlc_bool_t  b_lost_sync;
 };
 
 static int Demux  ( demux_t *p_demux );
@@ -107,6 +109,7 @@ static int Open( vlc_object_t *p_this )
     /* Init p_sys */
     p_sys->i_mux_rate = 0;
     p_sys->i_scr      = -1;
+    p_sys->b_lost_sync = VLC_FALSE;
 
     ps_psm_init( &p_sys->psm );
     ps_track_init( p_sys->tk );
@@ -177,10 +180,16 @@ static int Demux( demux_t *p_demux )
     }
     else if( i_ret == 0 )
     {
-        msg_Warn( p_demux, "garbage at input" );
+        if( !p_sys->b_lost_sync )
+            msg_Warn( p_demux, "garbage at input, trying to resync..." );
+
+        p_sys->b_lost_sync = VLC_TRUE;
         return 1;
     }
 
+    if( p_sys->b_lost_sync ) msg_Warn( p_demux, "found sync code" );
+    p_sys->b_lost_sync = VLC_FALSE;
+
     if( ( p_pkt = ps_pkt_read( p_demux->s, i_code ) ) == NULL )
     {
         return 0;