[vlc-devel] commit: input: Make sure stat info are created before attaching to the parent, because stats_ComputeGlobalStats() may vlc_list_find() the input before the stat have been initialized. (Pierre d'Herbemont )

git version control git at videolan.org
Fri Mar 28 10:40:00 CET 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Fri Mar 28 10:39:37 2008 +0100| [3a88025b6f2770d40262c8dbe906a41ce5e14b48]

input: Make sure stat info are created before attaching to the parent, because stats_ComputeGlobalStats() may vlc_list_find() the input before the stat have been initialized.

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

 src/input/input.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 2964d73..9d9f749 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -283,6 +283,16 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
         p_input->p->b_owns_its_sout = VLC_FALSE;
     }
 
+    /* Initialize optional stream output. (before access/demuxer)
+     * XXX: we add a special case if the uri starts by vlc.
+     * else 'vlc in.file --sout "" vlc:quit'  cannot work (the output will
+     * be destroyed in case of a file).
+     * (this will break playing of file starting by 'vlc:' but I don't
+     * want to add more logic, just force file by file:// or code it ;)
+     */
+    memset( &p_input->p->counters, 0, sizeof( p_input->p->counters ) );
+    vlc_mutex_init( p_input, &p_input->p->counters.counters_lock );
+
     /* Attach only once we are ready */
     vlc_object_attach( p_input, p_parent );
 
@@ -307,6 +317,8 @@ static void Destructor( input_thread_t * p_input )
             sout_DeleteInstance( priv->p_sout );
     }
 
+    vlc_mutex_destroy( &p_input->p->counters.counters_lock );
+
     vlc_mutex_destroy( &priv->lock_control );
     free( priv );
 }
@@ -761,16 +773,6 @@ static int Init( input_thread_t * p_input )
     int i_es_out_mode;
     int i, i_delay;
 
-    /* Initialize optional stream output. (before access/demuxer)
-     * XXX: we add a special case if the uri starts by vlc.
-     * else 'vlc in.file --sout "" vlc:quit'  cannot work (the output will
-     * be destroyed in case of a file).
-     * (this will break playing of file starting by 'vlc:' but I don't
-     * want to add more logic, just force file by file:// or code it ;)
-     */
-    memset( &p_input->p->counters, 0, sizeof( p_input->p->counters ) );
-    vlc_mutex_init( p_input, &p_input->p->counters.counters_lock );
-
     for( i = 0; i < p_input->p->input.p_item->i_options; i++ )
     {
         if( !strncmp( p_input->p->input.p_item->ppsz_options[i], "meta-file", 9 ) )
@@ -1341,8 +1343,6 @@ static void End( input_thread_t * p_input )
         TAB_CLEAN( p_input->p->i_attachment, p_input->p->attachment );
     }
 
-    vlc_mutex_destroy( &p_input->p->counters.counters_lock );
-
     /* Tell we're dead */
     p_input->b_dead = VLC_TRUE;
 }




More information about the vlc-devel mailing list