]> git.sesse.net Git - vlc/commitdiff
transcode: avoid double thread join
authorRafaël Carré <funman@videolan.org>
Tue, 6 Jan 2015 12:43:19 +0000 (13:43 +0100)
committerRafaël Carré <funman@videolan.org>
Tue, 6 Jan 2015 12:47:39 +0000 (13:47 +0100)
modules/stream_out/transcode/video.c

index 949a23f27c2d18cac1cd54d4d29ac452f12f9479..5bce6022bddab33ceb8d1fd4787f74f9d6c41ec4 100644 (file)
@@ -576,7 +576,7 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
 void transcode_video_close( sout_stream_t *p_stream,
                                    sout_stream_id_sys_t *id )
 {
-    if( p_stream->p_sys->i_threads >= 1 )
+    if( p_stream->p_sys->i_threads >= 1 && !p_stream->p_sys->b_abort )
     {
         vlc_mutex_lock( &p_stream->p_sys->lock_out );
         p_stream->p_sys->b_abort = true;
@@ -584,14 +584,15 @@ void transcode_video_close( sout_stream_t *p_stream,
         vlc_mutex_unlock( &p_stream->p_sys->lock_out );
 
         vlc_join( p_stream->p_sys->thread, NULL );
-        vlc_mutex_destroy( &p_stream->p_sys->lock_out );
-        vlc_cond_destroy( &p_stream->p_sys->cond );
 
         picture_fifo_Delete( p_stream->p_sys->pp_pics );
         block_ChainRelease( p_stream->p_sys->p_buffers );
         p_stream->p_sys->pp_pics = NULL;
     }
 
+    vlc_mutex_destroy( &p_stream->p_sys->lock_out );
+    vlc_cond_destroy( &p_stream->p_sys->cond );
+
     /* Close decoder */
     if( id->p_decoder->p_module )
         module_unneed( id->p_decoder, id->p_decoder->p_module );