[vlc-devel] commit: Revert [42a0d047849f391a75432dfdf5d71523d6ec08c7] ( Rafaël Carré )

git version control git at videolan.org
Wed May 14 15:19:52 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed May 14 15:21:15 2008 +0200| [4cc4c675d99ac00cce22edf44154c5379e051bff]

Revert [42a0d047849f391a75432dfdf5d71523d6ec08c7]

The kept sout needs to be attached to the playlist, else we will
try to destroy vlm's souts before it's time to.

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

 src/input/input.c   |   37 +++++++++++++++++++++++++------------
 src/libvlc-common.c |   19 +++++++++++++------
 2 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index eb5bfb4..60ee778 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1419,20 +1419,27 @@ static sout_instance_t *SoutFind( vlc_object_t *p_parent, input_item_t *p_item,
      * XXX it might be unusable but this will be checked later */
     if( b_keep_sout )
     {
-        p_sout = vlc_object_find( p_parent->p_libvlc, VLC_OBJECT_SOUT,
-                                                      FIND_CHILD );
-        if( p_sout )
+        playlist_t *p_playlist = vlc_object_find( p_parent->p_libvlc,
+                VLC_OBJECT_PLAYLIST, FIND_CHILD );
+        if( p_playlist )
         {
-            if( p_sout->p_parent != VLC_OBJECT( p_sout->p_libvlc ) )
-            {
-                vlc_object_release( p_sout );
-                p_sout = NULL;
-            }
-            else
+            vlc_mutex_lock( &p_playlist->gc_lock );
+            p_sout = vlc_object_find( p_playlist, VLC_OBJECT_SOUT, FIND_CHILD );
+            if( p_sout )
             {
-                vlc_object_detach( p_sout );    /* Remove it from the GC */
-                vlc_object_release( p_sout );
+                if( p_sout->p_parent != VLC_OBJECT( p_playlist ) )
+                {
+                    vlc_object_release( p_sout );
+                    p_sout = NULL;
+                }
+                else
+                {
+                    vlc_object_detach( p_sout );    /* Remove it from the GC */
+                    vlc_object_release( p_sout );
+                }
             }
+            vlc_mutex_unlock( &p_playlist->gc_lock );
+            vlc_object_release( p_playlist );
         }
     }
 
@@ -1444,8 +1451,14 @@ static sout_instance_t *SoutFind( vlc_object_t *p_parent, input_item_t *p_item,
 
 static void SoutKeep( sout_instance_t *p_sout )
 {
+    playlist_t * p_playlist = vlc_object_find( p_sout, VLC_OBJECT_PLAYLIST,
+                                                FIND_PARENT );
+    if( !p_playlist ) return;
+
     msg_Dbg( p_sout, "sout has been kept" );
-    vlc_object_attach( p_sout, p_sout->p_libvlc );
+    vlc_object_attach( p_sout, p_playlist );
+
+    vlc_object_release( p_playlist );
 }
 
 /*****************************************************************************
diff --git a/src/libvlc-common.c b/src/libvlc-common.c
index aa16cdd..18991b6 100644
--- a/src/libvlc-common.c
+++ b/src/libvlc-common.c
@@ -960,15 +960,22 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     }
 
 #ifdef ENABLE_SOUT
+    playlist_t         * p_playlist;
     sout_instance_t    * p_sout;
 
-    p_sout = vlc_object_find( p_libvlc, VLC_OBJECT_SOUT, FIND_CHILD );
-    if( p_sout )
+    p_playlist = vlc_object_find( p_libvlc, VLC_OBJECT_PLAYLIST, FIND_CHILD );
+    if( p_playlist )
     {
-        msg_Dbg( p_sout, "removing kept stream output" );
-        vlc_object_detach( (vlc_object_t*)p_sout );
-        vlc_object_release( (vlc_object_t*)p_sout );
-        sout_DeleteInstance( p_sout );
+        p_sout = vlc_object_find( p_playlist, VLC_OBJECT_SOUT, FIND_CHILD );
+        if( p_sout )
+        {
+            msg_Dbg( p_sout, "removing kept stream output" );
+            vlc_object_detach( (vlc_object_t*)p_sout );
+            vlc_object_release( (vlc_object_t*)p_sout );
+            sout_DeleteInstance( p_sout );
+        }
+
+        vlc_object_release( p_playlist );
     }
 
     /* Destroy VLM if created in libvlc_InternalInit */




More information about the vlc-devel mailing list