Commit e350259a authored by Rafaël Carré's avatar Rafaël Carré

transcode: simplify thread init

parent ead2838c
...@@ -212,37 +212,35 @@ int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_sys_t *id ) ...@@ -212,37 +212,35 @@ int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
} }
id->p_encoder->p_module = NULL; id->p_encoder->p_module = NULL;
if( p_sys->i_threads >= 1 ) if( p_sys->i_threads <= 0 )
return VLC_SUCCESS;
int i_priority = p_sys->b_high_priority ? VLC_THREAD_PRIORITY_OUTPUT :
VLC_THREAD_PRIORITY_VIDEO;
p_sys->id_video = id;
p_sys->pp_pics = picture_fifo_New();
if( p_sys->pp_pics == NULL )
{ {
int i_priority = p_sys->b_high_priority ? VLC_THREAD_PRIORITY_OUTPUT : msg_Err( p_stream, "cannot create picture fifo" );
VLC_THREAD_PRIORITY_VIDEO; module_unneed( id->p_decoder, id->p_decoder->p_module );
p_sys->id_video = id; id->p_decoder->p_module = NULL;
vlc_mutex_init( &p_sys->lock_out ); free( id->p_decoder->p_owner );
vlc_cond_init( &p_sys->cond ); return VLC_ENOMEM;
p_sys->pp_pics = picture_fifo_New(); }
if( p_sys->pp_pics == NULL ) vlc_mutex_init( &p_sys->lock_out );
{ vlc_cond_init( &p_sys->cond );
msg_Err( p_stream, "cannot create picture fifo" ); p_sys->p_buffers = NULL;
vlc_mutex_destroy( &p_sys->lock_out ); p_sys->b_abort = false;
vlc_cond_destroy( &p_sys->cond ); if( vlc_clone( &p_sys->thread, EncoderThread, p_sys, i_priority ) )
module_unneed( id->p_decoder, id->p_decoder->p_module ); {
id->p_decoder->p_module = NULL; msg_Err( p_stream, "cannot spawn encoder thread" );
free( id->p_decoder->p_owner ); vlc_mutex_destroy( &p_sys->lock_out );
return VLC_ENOMEM; vlc_cond_destroy( &p_sys->cond );
} picture_fifo_Delete( p_sys->pp_pics );
p_sys->p_buffers = NULL; module_unneed( id->p_decoder, id->p_decoder->p_module );
p_sys->b_abort = false; id->p_decoder->p_module = NULL;
if( vlc_clone( &p_sys->thread, EncoderThread, p_sys, i_priority ) ) free( id->p_decoder->p_owner );
{ return VLC_EGENERIC;
msg_Err( p_stream, "cannot spawn encoder thread" );
vlc_mutex_destroy( &p_sys->lock_out );
vlc_cond_destroy( &p_sys->cond );
picture_fifo_Delete( p_sys->pp_pics );
module_unneed( id->p_decoder, id->p_decoder->p_module );
id->p_decoder->p_module = NULL;
free( id->p_decoder->p_owner );
return VLC_EGENERIC;
}
} }
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment