[vlc-commits] transcode: avoid double thread join

Rafaël Carré git at videolan.org
Tue Jan 6 13:47:52 CET 2015


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Jan  6 13:43:19 2015 +0100| [a4a43a825d41d7a3d3a59020ffecca5617ca8664] | committer: Rafaël Carré

transcode: avoid double thread join

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

 modules/stream_out/transcode/video.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 949a23f..5bce602 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -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 );



More information about the vlc-commits mailing list