Do not access b_die directly
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 10 Nov 2012 17:22:47 +0000 (19:22 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 10 Nov 2012 17:22:47 +0000 (19:22 +0200)
lib/media_player.c
modules/access/linsys/linsys_hdsdi.c
modules/access/mms/mms.c
modules/access/mms/mmstu.c
modules/stream_filter/smooth/smooth.c
src/input/es_out.c
src/input/stream.c
src/network/io.c
src/playlist/item.c
src/playlist/thread.c

index 2eb524d..0ac4896 100644 (file)
@@ -1230,7 +1230,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
     if ( !p_input_thread )
         return false;
 
-    b_will_play = !p_input_thread->b_die && !p_input_thread->b_dead;
+    b_will_play = !p_input_thread->b_dead;
     vlc_object_release( p_input_thread );
 
     return b_will_play;
index 457886b..bc480ee 100644 (file)
@@ -669,7 +669,7 @@ static int InitCapture( demux_t *p_demux )
     }
 
     /* Wait for standard to settle down */
-    while ( !p_demux->b_die )
+    while ( vlc_object_alive(p_demux) )
     {
         struct pollfd pfd[1];
 
@@ -707,7 +707,7 @@ static int InitCapture( demux_t *p_demux )
             }
         }
     }
-    if ( p_demux->b_die )
+    if ( !vlc_object_alive(p_demux) )
     {
         close( p_sys->i_vfd );
         return VLC_EGENERIC;
index f01c1ed..50662b8 100644 (file)
@@ -119,7 +119,7 @@ static int Open( vlc_object_t *p_this )
 
     if( MMSTUOpen ( p_access ) )
     {
-        if( p_access->b_die )
+        if( !vlc_object_alive(p_access) )
             return VLC_EGENERIC;
 
         /* try mmsh if mmstu failed */
index 972532b..7ffc206 100644 (file)
@@ -140,7 +140,7 @@ int  MMSTUOpen( access_t *p_access )
     {   /* first try with TCP and then UDP*/
         if( ( i_status = MMSOpen( p_access, &p_sys->url, MMS_PROTO_TCP ) ) )
         {
-            if( !p_access->b_die )
+            if( vlc_object_alive(p_access) )
                 i_status = MMSOpen( p_access, &p_sys->url, MMS_PROTO_UDP );
         }
     }
index 15bc5f7..f0c3d8a 100644 (file)
@@ -528,7 +528,7 @@ static chunk_t *get_chunk( stream_t *s, const bool wait )
          * that's why vlc_object_alive() has been deprecated. But if I
          * understood well, there is no good solution with a stream_filter
          * module anyaway. */
-        if( !wait || s->b_die || p_sys->b_error )
+        if( !wait || p_sys->b_error )
         {
             vlc_mutex_unlock( &p_sys->download.lock_wait );
             msg_Warn( s, "get_chunk failed! (playback index %u)",
index 1a0053d..c566287 100644 (file)
@@ -2015,7 +2015,7 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
     /* We don't try to reselect */
     if( es->p_dec )
     {
-        while( !p_sys->p_input->b_die && !p_sys->b_buffering && es->p_dec )
+        while( vlc_object_alive(p_sys->p_input) && !p_sys->b_buffering && es->p_dec )
         {
             if( input_DecoderIsEmpty( es->p_dec ) &&
                 ( !es->p_dec_record || input_DecoderIsEmpty( es->p_dec_record ) ))
index fa01b3e..bf72c7a 100644 (file)
@@ -662,7 +662,7 @@ static void AStreamPrebufferBlock( stream_t *s )
         bool b_eof;
         block_t *b;
 
-        if( s->b_die || p_sys->block.i_size > STREAM_CACHE_PREBUFFER_SIZE )
+        if( !vlc_object_alive(s) || p_sys->block.i_size > STREAM_CACHE_PREBUFFER_SIZE )
         {
             int64_t i_byterate;
 
@@ -1000,7 +1000,7 @@ static int AStreamRefillBlock( stream_t *s )
     {
         bool b_eof;
 
-        if( s->b_die )
+        if( !vlc_object_alive(s) )
             return VLC_EGENERIC;
 
         /* Fetch a block */
@@ -1356,7 +1356,7 @@ static int AStreamRefillStream( stream_t *s )
         int i_off = tk->i_end % STREAM_CACHE_TRACK_SIZE;
         int i_read;
 
-        if( s->b_die )
+        if( !vlc_object_alive(s) )
             return VLC_EGENERIC;
 
         i_read = __MIN( i_toread, STREAM_CACHE_TRACK_SIZE - i_off );
@@ -1417,7 +1417,7 @@ static void AStreamPrebufferStream( stream_t *s )
         int i_read;
         int i_buffered = tk->i_end - tk->i_start;
 
-        if( s->b_die || i_buffered >= STREAM_CACHE_PREBUFFER_SIZE )
+        if( !vlc_object_alive(s) || i_buffered >= STREAM_CACHE_PREBUFFER_SIZE )
         {
             int64_t i_byterate;
 
index f651a8e..7cc9764 100644 (file)
@@ -288,7 +288,6 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
         {
             if (ufd[1].revents)
             {
-                assert (p_this->b_die);
                 msg_Dbg (p_this, "socket %d polling interrupted", fd);
 #if defined(WIN32)
                 WSASetLastError (WSAEINTR);
@@ -442,7 +441,6 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
         {
             if (ufd[1].revents)
             {
-                assert (p_this->b_die);
                 errno = EINTR;
                 goto error;
             }
index 2b99dce..f5fde96 100644 (file)
@@ -451,7 +451,8 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
                        bool b_locked )
 {
     playlist_item_t *p_item;
-    if( p_playlist->b_die ) return VLC_EGENERIC;
+    /* FIXME: use b_killed instead: */
+    if( !vlc_object_alive(p_playlist) ) return VLC_EGENERIC;
     if( !pl_priv(p_playlist)->b_doing_ml )
         PL_DEBUG( "adding item `%s' ( %s )", p_input->psz_name,
                                              p_input->psz_uri );
@@ -493,8 +494,10 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
     assert( p_input );
     assert( p_parent && p_parent->i_children != -1 );
 
-    if( p_playlist->b_die )
+    /* FIXME: use b_killed instead: */
+    if( !vlc_object_alive(p_playlist) )
         return NULL;
+
     PL_LOCK_IF( !b_locked );
 
     p_item = playlist_ItemNewFromInput( p_playlist, p_input );
index 68d11a2..07a6b71 100644 (file)
@@ -459,7 +459,7 @@ static int LoopInput( playlist_t *p_playlist )
     if( !p_input )
         return VLC_EGENERIC;
 
-    if( ( p_sys->request.b_request || p_sys->killed ) && !p_input->b_die )
+    if( ( p_sys->request.b_request || p_sys->killed ) && vlc_object_alive(p_input) )
     {
         PL_DEBUG( "incoming request - stopping current input" );
         input_Stop( p_input, true );
@@ -490,7 +490,7 @@ static int LoopInput( playlist_t *p_playlist )
         return VLC_EGENERIC;
     }
     /* This input is dying, let it do */
-    else if( p_input->b_die )
+    else if( !vlc_object_alive(p_input) )
     {
         PL_DEBUG( "dying input" );
     }