Skip to content

Commit

Permalink
transcode: avoid double thread join
Browse files Browse the repository at this point in the history
  • Loading branch information
funman committed Jan 6, 2015
1 parent e350259 commit a4a43a8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/stream_out/transcode/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,22 +576,23 @@ 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;
vlc_cond_signal( &p_stream->p_sys->cond );
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 );
Expand Down

0 comments on commit a4a43a8

Please sign in to comment.