[vlc-commits] stream_Demux: destroy the demux from the thread

Rémi Denis-Courmont git at videolan.org
Tue Aug 21 16:38:40 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 21 17:36:16 2012 +0300| [2b58ea4465feabc3b053dce1a4445307324a1668] | committer: Rémi Denis-Courmont

stream_Demux: destroy the demux from the thread

This is simpler and more consistent.

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

 src/input/stream_demux.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index f2ec7ff..057ef03 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -44,7 +44,6 @@ struct stream_sys_t
     /* Demuxer */
     char        *psz_name;
     es_out_t    *out;
-    demux_t     *p_demux;
 
     vlc_thread_t thread;
 };
@@ -82,7 +81,6 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
 
     p_sys->i_pos = 0;
     p_sys->out = out;
-    p_sys->p_demux = NULL;
     p_sys->p_block = NULL;
     p_sys->psz_name = strdup( psz_demux );
 
@@ -122,8 +120,6 @@ static void DStreamDelete( stream_t *s )
     block_FifoPut( p_sys->p_fifo, p_empty );
     vlc_join( p_sys->thread, NULL );
 
-    if( p_sys->p_demux )
-        demux_Delete( p_sys->p_demux );
     if( p_sys->p_block )
         block_Release( p_sys->p_block );
 
@@ -278,16 +274,14 @@ static void* DStreamThread( void *obj )
     int canc = vlc_savecancel();
 
     /* Create the demuxer */
-    if( !(p_demux = demux_New( s, s->p_input, "", p_sys->psz_name, "", s, p_sys->out,
-                               false )) )
-    {
+    p_demux = demux_New( s, s->p_input, "", p_sys->psz_name, "", s, p_sys->out,
+                         false );
+    if( p_demux == NULL )
         return NULL;
-    }
 
     /* stream_Demux cannot apply DVB filters.
      * Get all programs and let the E/S output sort them out. */
     demux_Control( p_demux, DEMUX_SET_GROUP, -1, NULL );
-    p_sys->p_demux = p_demux;
 
     /* Main loop */
     while( vlc_object_alive( s ) )
@@ -295,6 +289,8 @@ static void* DStreamThread( void *obj )
         if( demux_Demux( p_demux ) <= 0 ) break;
     }
 
+    demux_Delete( p_demux );
+
     vlc_restorecancel( canc );
     return NULL;
 }



More information about the vlc-commits mailing list