]> git.sesse.net Git - vlc/commitdiff
Fixed a bug (glitch/segfault) when seeking.
authorChristophe Massiot <massiot@videolan.org>
Tue, 14 May 2002 21:23:44 +0000 (21:23 +0000)
committerChristophe Massiot <massiot@videolan.org>
Tue, 14 May 2002 21:23:44 +0000 (21:23 +0000)
include/input_ext-plugins.h
src/input/input.c
src/input/input_clock.c
src/input/input_dec.c

index 431c78f9e34a87cb56136793a1ff941bf1282a89..6d2606d4c7ba889642717faffe3bdb0b222b6e9d 100644 (file)
@@ -3,7 +3,7 @@
  *                      but exported to plug-ins
  *****************************************************************************
  * Copyright (C) 1999-2002 VideoLAN
- * $Id: input_ext-plugins.h,v 1.25 2002/05/10 02:04:16 fenrir Exp $
+ * $Id: input_ext-plugins.h,v 1.26 2002/05/14 21:23:44 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -81,8 +81,7 @@ vlc_thread_t input_RunDecoder( struct input_thread_s *,
                                struct es_descriptor_s * );
 void input_EndDecoder( struct input_thread_s *, struct es_descriptor_s * );
 void input_DecodePES ( struct decoder_fifo_s *, struct pes_packet_s * );
-void input_EscapeDiscontinuity( struct input_thread_s *,
-                                struct pgrm_descriptor_s * );
+void input_EscapeDiscontinuity( struct input_thread_s * );
 void input_EscapeAudioDiscontinuity( struct input_thread_s * );
 #else
 #   define input_DecodePES p_symbols->input_DecodePES
index b267d13a7be64c9934cf030b9b64c684ee12eb25..87c1ada0227460c842060134ec309ae6e36e8009 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input.c,v 1.194 2002/04/23 14:16:20 sam Exp $
+ * $Id: input.c,v 1.195 2002/05/14 21:23:44 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -307,13 +307,14 @@ static int RunThread( input_thread_t *p_input )
                 p_input->pf_set_program( p_input, 
                         p_input->stream.p_new_program );
 
+                /* Escape all decoders for the stream discontinuity they
+                 * will encounter. */
+                input_EscapeDiscontinuity( p_input );
+
                 for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
                 {
                     pgrm_descriptor_t * p_pgrm
                                             = p_input->stream.pp_programs[i];
-                    /* Escape all decoders for the stream discontinuity they
-                     * will encounter. */
-                    input_EscapeDiscontinuity( p_input, p_pgrm );
 
                     /* Reinitialize synchro. */
                     p_pgrm->i_synchro_state = SYNCHRO_REINIT;
@@ -330,13 +331,14 @@ static int RunThread( input_thread_t *p_input )
 
                 p_input->pf_set_area( p_input, p_input->stream.p_new_area );
 
+                /* Escape all decoders for the stream discontinuity they
+                 * will encounter. */
+                input_EscapeDiscontinuity( p_input );
+
                 for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
                 {
                     pgrm_descriptor_t * p_pgrm
                                             = p_input->stream.pp_programs[i];
-                    /* Escape all decoders for the stream discontinuity they
-                     * will encounter. */
-                    input_EscapeDiscontinuity( p_input, p_pgrm );
 
                     /* Reinitialize synchro. */
                     p_pgrm->i_synchro_state = SYNCHRO_REINIT;
@@ -359,13 +361,14 @@ static int RunThread( input_thread_t *p_input )
                 p_input->pf_seek( p_input, i_new_pos );
                 vlc_mutex_lock( &p_input->stream.stream_lock );
 
+                /* Escape all decoders for the stream discontinuity they
+                 * will encounter. */
+                input_EscapeDiscontinuity( p_input );
+
                 for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
                 {
                     pgrm_descriptor_t * p_pgrm
                                             = p_input->stream.pp_programs[i];
-                    /* Escape all decoders for the stream discontinuity they
-                     * will encounter. */
-                    input_EscapeDiscontinuity( p_input, p_pgrm );
 
                     /* Reinitialize synchro. */
                     p_pgrm->i_synchro_state = SYNCHRO_REINIT;
index 96af2abba727252e972facfab268abcfe5241feb..3479311c4d7827f0ae16b0a0bbeef1a2028ea816 100644 (file)
@@ -2,7 +2,7 @@
  * input_clock.c: Clock/System date convertions, stream management
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: input_clock.c,v 1.29 2002/03/05 17:46:33 stef Exp $
+ * $Id: input_clock.c,v 1.30 2002/05/14 21:23:44 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -257,7 +257,7 @@ void input_ClockManageRef( input_thread_t * p_input,
             intf_WarnMsg( 1, "Clock gap, unexpected stream discontinuity" );
             input_ClockInit( p_pgrm );
             p_pgrm->i_synchro_state = SYNCHRO_START;
-            input_EscapeDiscontinuity( p_input, p_pgrm );
+            input_EscapeDiscontinuity( p_input );
         }
 
         p_pgrm->last_cr = i_clock;
index 3a87d4aa6dfc829e7c833c76585836a4235467e8..cc0af10e516eff2ab3b61294d9fb5ffb044af438 100644 (file)
@@ -2,7 +2,7 @@
  * input_dec.c: Functions for the management of decoders
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: input_dec.c,v 1.33 2002/05/12 01:39:36 massiot Exp $
+ * $Id: input_dec.c,v 1.34 2002/05/14 21:23:44 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -159,14 +159,13 @@ void input_DecodePES( decoder_fifo_t * p_decoder_fifo, pes_packet_t * p_pes )
 /*****************************************************************************
  * input_EscapeDiscontinuity: send a NULL packet to the decoders
  *****************************************************************************/
-void input_EscapeDiscontinuity( input_thread_t * p_input,
-                                pgrm_descriptor_t * p_pgrm )
+void input_EscapeDiscontinuity( input_thread_t * p_input )
 {
     int     i_es, i;
 
-    for( i_es = 0; i_es < p_pgrm->i_es_number; i_es++ )
+    for( i_es = 0; i_es < p_input->stream.i_selected_es_number; i_es++ )
     {
-        es_descriptor_t * p_es = p_pgrm->pp_es[i_es];
+        es_descriptor_t * p_es = p_input->stream.pp_selected_es[i_es];
 
         if( p_es->p_decoder_fifo != NULL )
         {
@@ -183,22 +182,17 @@ void input_EscapeDiscontinuity( input_thread_t * p_input,
  *****************************************************************************/
 void input_EscapeAudioDiscontinuity( input_thread_t * p_input )
 {
-    int     i_pgrm, i_es, i;
+    int     i_es, i;
 
-    for( i_pgrm = 0; i_pgrm < p_input->stream.i_pgrm_number; i_pgrm++ )
+    for( i_es = 0; i_es < p_input->stream.i_selected_es_number; i_es++ )
     {
-        pgrm_descriptor_t * p_pgrm = p_input->stream.pp_programs[i_pgrm];
+        es_descriptor_t * p_es = p_input->stream.pp_selected_es[i_es];
 
-        for( i_es = 0; i_es < p_pgrm->i_es_number; i_es++ )
+        if( p_es->p_decoder_fifo != NULL && p_es->b_audio )
         {
-            es_descriptor_t * p_es = p_pgrm->pp_es[i_es];
-
-            if( p_es->p_decoder_fifo != NULL && p_es->b_audio )
+            for( i = 0; i < PADDING_PACKET_NUMBER; i++ )
             {
-                for( i = 0; i < PADDING_PACKET_NUMBER; i++ )
-                {
-                    input_NullPacket( p_input, p_es );
-                }
+                input_NullPacket( p_input, p_es );
             }
         }
     }