From 393a5d5241b2088db43ba29e4c9774743f61a4f1 Mon Sep 17 00:00:00 2001 From: Henri Fallon <henri@videolan.org> Date: Sun, 7 Jan 2001 03:56:40 +0000 Subject: [PATCH] - Added vlc_mutex_destroy and vlc_cond_destroy function, for pthreads. - Used them before quitting, every lock and cond is destroyed - Checked the return value of malloc and realloc in input_programs - Cosmetic changes TODO: add vlc_*_destroy for beos and C_thread --- include/threads.h | 105 +++++++++++++++++++------------- plugins/alsa/alsa.c | 1 - plugins/alsa/aout_alsa.c | 2 +- src/audio_output/audio_output.c | 11 ++++ src/input/input.c | 6 +- src/input/input_dec.c | 6 +- src/input/input_netlist.c | 5 +- src/input/input_programs.c | 79 +++++++++++++++++++++--- src/interface/intf_msg.c | 3 + src/misc/modules.c | 3 + src/video_output/video_output.c | 13 ++++ src/video_parser/video_fifo.c | 3 +- src/video_parser/video_parser.c | 12 +++- src/video_parser/vpar_headers.c | 3 +- 14 files changed, 194 insertions(+), 58 deletions(-) diff --git a/include/threads.h b/include/threads.h index cd7c0d23af..7d195508dc 100644 --- a/include/threads.h +++ b/include/threads.h @@ -70,7 +70,13 @@ * Types definition *****************************************************************************/ -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + +typedef pthread_t vlc_thread_t; +typedef pthread_mutex_t vlc_mutex_t; +typedef pthread_cond_t vlc_cond_t; + +#elif defined(HAVE_CTHREADS_H) typedef cthread_t vlc_thread_t; @@ -111,12 +117,6 @@ typedef struct thread_id thread; } vlc_cond_t; -#elif defined(HAVE_PTHREAD_H) - -typedef pthread_t vlc_thread_t; -typedef pthread_mutex_t vlc_mutex_t; -typedef pthread_cond_t vlc_cond_t; - #endif typedef void *(*vlc_thread_func_t)(void *p_data); @@ -130,13 +130,15 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, char *psz_name static __inline__ void vlc_thread_exit ( void ); static __inline__ void vlc_thread_join ( vlc_thread_t thread ); -static __inline__ int vlc_mutex_init ( vlc_mutex_t *p_mutex ); -static __inline__ int vlc_mutex_lock ( vlc_mutex_t *p_mutex ); -static __inline__ int vlc_mutex_unlock ( vlc_mutex_t *p_mutex ); +static __inline__ int vlc_mutex_init ( vlc_mutex_t *p_mutex ); +static __inline__ int vlc_mutex_lock ( vlc_mutex_t *p_mutex ); +static __inline__ int vlc_mutex_unlock ( vlc_mutex_t *p_mutex ); +static __inline__ int vlc_mutex_destroy ( vlc_mutex_t *p_mutex ); static __inline__ int vlc_cond_init ( vlc_cond_t *p_condvar ); static __inline__ int vlc_cond_signal ( vlc_cond_t *p_condvar ); static __inline__ int vlc_cond_wait ( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex ); +static __inline__ int vlc_cond_destroy ( vlc_cond_t *p_condvar ); #if 0 static _inline__ int vlc_cond_timedwait ( vlc_cond_t * condvar, vlc_mutex_t * mutex, @@ -170,16 +172,16 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, *****************************************************************************/ static __inline__ void vlc_thread_exit( void ) { -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + pthread_exit( 0 ); + +#elif defined(HAVE_CTHREADS_H) int result; cthread_exit( &result ); #elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) exit_thread( 0 ); -#elif defined(HAVE_PTHREAD_H) - pthread_exit( 0 ); - #endif } @@ -188,16 +190,16 @@ static __inline__ void vlc_thread_exit( void ) *****************************************************************************/ static __inline__ void vlc_thread_join( vlc_thread_t thread ) { -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + pthread_join( thread, NULL ); + +#elif defined(HAVE_CTHREADS_H) cthread_join( thread ); #elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H) int32 exit_value; wait_for_thread( thread, &exit_value ); -#elif defined(HAVE_PTHREAD_H) - pthread_join( thread, NULL ); - #endif } @@ -206,7 +208,10 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread ) *****************************************************************************/ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) { -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + return pthread_mutex_init( p_mutex, NULL ); + +#elif defined(HAVE_CTHREADS_H) mutex_init( p_mutex ); return 0; @@ -225,9 +230,6 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) p_mutex->init = 9999; return B_OK; -#elif defined(HAVE_PTHREAD_H) - return pthread_mutex_init( p_mutex, NULL ); - #endif } @@ -236,7 +238,10 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) *****************************************************************************/ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) { -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + return pthread_mutex_lock( p_mutex ); + +#elif defined(HAVE_CTHREADS_H) mutex_lock( p_mutex ); return 0; @@ -249,9 +254,6 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) err = acquire_sem( p_mutex->lock ); return err; -#elif defined(HAVE_PTHREAD_H) - return pthread_mutex_lock( p_mutex ); - #endif } @@ -260,7 +262,10 @@ static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex ) *****************************************************************************/ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) { -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + return pthread_mutex_unlock( p_mutex ); + +#elif defined(HAVE_CTHREADS_H) mutex_unlock( p_mutex ); return 0; @@ -272,18 +277,28 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) release_sem( p_mutex->lock ); return B_OK; -#elif defined(HAVE_PTHREAD_H) - return pthread_mutex_unlock( p_mutex ); - #endif } +/***************************************************************************** + * vlc_mutex_destroy: destory a mutex + *****************************************************************************/ +static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex ) +{ +#if defined(HAVE_PTHREAD_H) + return pthread_mutex_destroy( p_mutex ); +#endif +} + /***************************************************************************** * vlc_cond_init: initialize a condition *****************************************************************************/ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) { -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + return pthread_cond_init( p_condvar, NULL ); + +#elif defined(HAVE_CTHREADS_H) /* condition_init() */ spin_lock_init( &p_condvar->lock ); cthread_queue_init( &p_condvar->queue ); @@ -303,9 +318,6 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) p_condvar->init = 9999; return 0; -#elif defined(HAVE_PTHREAD_H) - return pthread_cond_init( p_condvar, NULL ); - #endif } @@ -314,7 +326,10 @@ static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar ) *****************************************************************************/ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) { -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + return pthread_cond_signal( p_condvar ); + +#elif defined(HAVE_CTHREADS_H) /* condition_signal() */ if ( p_condvar->queue.head || p_condvar->implications ) { @@ -351,9 +366,6 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) return 0; -#elif defined(HAVE_PTHREAD_H) - return pthread_cond_signal( p_condvar ); - #endif } @@ -362,7 +374,10 @@ static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar ) *****************************************************************************/ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex ) { -#if defined(HAVE_CTHREADS_H) +#if defined(HAVE_PTHREAD_H) + return pthread_cond_wait( p_condvar, p_mutex ); + +#elif defined(HAVE_CTHREADS_H) condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex ); return 0; @@ -384,9 +399,15 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex vlc_mutex_lock( p_mutex ); return 0; -#elif defined(HAVE_PTHREAD_H) - return pthread_cond_wait( p_condvar, p_mutex ); - #endif } +/***************************************************************************** + * vlc_cond_destory: destroy a condition + *****************************************************************************/ +static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar ) +{ +#if defined(HAVE_PTHREAD_H) + return pthread_cond_destroy( p_condvar ); +#endif +} diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 91652a2daf..0ddf1c5c86 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -66,7 +66,6 @@ void aout_AlsaClose ( aout_thread_t *p_aout ); *****************************************************************************/ plugin_info_t * GetConfig( void ) { - int i_fd; plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); p_info->psz_name = "Alsa plugin"; diff --git a/plugins/alsa/aout_alsa.c b/plugins/alsa/aout_alsa.c index d9c813548d..7436e49189 100644 --- a/plugins/alsa/aout_alsa.c +++ b/plugins/alsa/aout_alsa.c @@ -259,7 +259,7 @@ long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_limit ) return ( 1 ); } - switch (alsa_channel_status.status) + switch( alsa_channel_status.status ) { case SND_PCM_STATUS_NOTREADY : intf_ErrMsg("Status NOT READY"); break; diff --git a/src/audio_output/audio_output.c b/src/audio_output/audio_output.c index f637bb3152..473857bc51 100644 --- a/src/audio_output/audio_output.c +++ b/src/audio_output/audio_output.c @@ -339,6 +339,9 @@ static int aout_SpawnThread( aout_thread_t * p_aout ) *****************************************************************************/ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status ) { + + int i_fifo; + /* FIXME: pi_status is not handled correctly: check vout how to do!?? */ intf_DbgMsg("aout debug: requesting termination of audio output thread (%p)", p_aout); @@ -351,6 +354,14 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status ) free( p_aout->buffer ); free( p_aout->s32_buffer ); + /* Destroy the condition and mutex locks */ + vlc_mutex_destroy( &p_aout->fifos_lock ); + for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ ) + { + vlc_mutex_destroy( &p_aout->fifo[i_fifo].data_lock ); + vlc_cond_destroy( &p_aout->fifo[i_fifo].data_wait ); + } + /* Free the structure */ p_aout->p_sys_close( p_aout ); intf_DbgMsg("aout debug: audio device (%s) closed", p_aout->psz_device); diff --git a/src/input/input.c b/src/input/input.c index a046ed360f..1edfcd777d 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -4,7 +4,7 @@ * decoders. ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: input.c,v 1.65 2001/01/05 14:45:47 sam Exp $ + * $Id: input.c,v 1.66 2001/01/07 03:56:40 henri Exp $ * * Authors: * @@ -318,6 +318,10 @@ static void EndThread( input_thread_t * p_input ) p_input->p_plugin->pf_end( p_input ); free( p_input->p_plugin ); + /* Destroy Mutex locks */ + vlc_mutex_destroy( &p_input->stream.stream_lock ); + vlc_mutex_destroy( &p_input->stream.control.control_lock ); + /* Free input structure */ free( p_input ); diff --git a/src/input/input_dec.c b/src/input/input_dec.c index 3bfd489929..e829cb526f 100644 --- a/src/input/input_dec.c +++ b/src/input/input_dec.c @@ -2,7 +2,7 @@ * input_dec.c: Functions for the management of decoders ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_dec.c,v 1.2 2000/12/22 10:58:27 massiot Exp $ + * $Id: input_dec.c,v 1.3 2001/01/07 03:56:40 henri Exp $ * * Authors: Christophe Massiot <massiot@via.ecp.fr> * @@ -57,6 +57,10 @@ void input_EndDecoder( decoder_fifo_t * p_decoder_fifo, vlc_thread_t thread_id ) vlc_cond_signal( &p_decoder_fifo->data_wait ); vlc_mutex_unlock( &p_decoder_fifo->data_lock ); + /* Destroy the lock and cond */ + vlc_cond_destroy( &p_decoder_fifo->data_wait ); + vlc_mutex_destroy( &p_decoder_fifo->data_lock ); + /* Waiting for the thread to exit */ vlc_thread_join( thread_id ); diff --git a/src/input/input_netlist.c b/src/input/input_netlist.c index 46e7659fdf..fc8dc0d09d 100644 --- a/src/input/input_netlist.c +++ b/src/input/input_netlist.c @@ -2,7 +2,7 @@ * input_netlist.c: netlist management ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: input_netlist.c,v 1.27 2001/01/06 05:44:45 henri Exp $ + * $Id: input_netlist.c,v 1.28 2001/01/07 03:56:40 henri Exp $ * * Authors: Henri Fallon <henri@videolan.org> * @@ -387,6 +387,9 @@ void input_NetlistEnd( input_thread_t * p_input) /* cast */ p_netlist = ( netlist_t * ) p_input->p_method_data; + /* destroy the mutex lock */ + vlc_mutex_destroy (&p_netlist->lock); + /* free the FIFO, the buffer, and the netlist structure */ free (p_netlist->pp_free_data); free (p_netlist->pp_free_pes); diff --git a/src/input/input_programs.c b/src/input/input_programs.c index 3f54c81567..5cd3b4a4b2 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -1,9 +1,8 @@ /***************************************************************************** * input_programs.c: es_descriptor_t, pgrm_descriptor_t management - * FIXME : check the return value of realloc() and malloc() ! ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_programs.c,v 1.18 2000/12/28 18:00:38 massiot Exp $ + * $Id: input_programs.c,v 1.19 2001/01/07 03:56:40 henri Exp $ * * Authors: * @@ -62,7 +61,12 @@ void input_InitStream( input_thread_t * p_input, size_t i_data_len ) if( i_data_len ) { - p_input->stream.p_demux_data = malloc( i_data_len ); + if ( (p_input->stream.p_demux_data = malloc( i_data_len )) == NULL ) + { + intf_ErrMsg( "Unable to allocate memory in input_InitStream"); + /* FIXME : find a way to tell if failed */ + return; + } memset( p_input->stream.p_demux_data, 0, i_data_len ); } } @@ -127,11 +131,21 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input, p_input->stream.pp_programs = realloc( p_input->stream.pp_programs, p_input->stream.i_pgrm_number * sizeof(pgrm_descriptor_t *) ); - + if( p_input->stream.pp_programs == NULL ) + { + intf_ErrMsg( "Unable to realloc memory in input_AddProgram" ); + return NULL; + } + /* Allocate the structure to store this description */ p_input->stream.pp_programs[i_pgrm_index] = malloc( sizeof(pgrm_descriptor_t) ); - + if( p_input->stream.pp_programs[i_pgrm_index] == NULL ) + { + intf_ErrMsg( "Unable to allocate memory in input_AddProgram" ); + return NULL; + } + /* Init this entry */ p_input->stream.pp_programs[i_pgrm_index]->i_number = i_pgrm_id; p_input->stream.pp_programs[i_pgrm_index]->b_is_ok = 0; @@ -157,6 +171,11 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input, { p_input->stream.pp_programs[i_pgrm_index]->p_demux_data = malloc( i_data_len ); + if( p_input->stream.pp_programs[i_pgrm_index]->p_demux_data == NULL ) + { + intf_ErrMsg( "Unable to allocate memory in input_AddProgram" ); + return NULL; + } memset( p_input->stream.pp_programs[i_pgrm_index]->p_demux_data, 0, i_data_len ); } @@ -208,6 +227,10 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm ) p_input->stream.i_pgrm_number * sizeof(pgrm_descriptor_t *) ); + if( p_input->stream.pp_programs == NULL) + { + intf_ErrMsg( "Unable to realloc memory in input_DelProgram" ); + } /* Free the description of this program */ free( p_pgrm ); } @@ -246,10 +269,20 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, intf_DbgMsg("Adding description for ES 0x%x", i_es_id); p_es = (es_descriptor_t *)malloc( sizeof(es_descriptor_t) ); + if( p_es == NULL ) + { + intf_ErrMsg( "Unable to allocate memory in input_AddES" ); + return NULL; + } p_input->stream.i_es_number++; p_input->stream.pp_es = realloc( p_input->stream.pp_es, p_input->stream.i_es_number * sizeof(es_descriptor_t *) ); + if( p_input->stream.pp_es == NULL ) + { + intf_ErrMsg( "Unable to realloc memory in input_AddES" ); + return NULL; + } p_input->stream.pp_es[p_input->stream.i_es_number - 1] = p_es; p_es->i_id = i_es_id; @@ -261,6 +294,11 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, if( i_data_len ) { p_es->p_demux_data = malloc( i_data_len ); + if( p_es->p_demux_data == NULL ) + { + intf_ErrMsg( "Unable to allocate memory in input_AddES" ); + return NULL; + } memset( p_es->p_demux_data, 0, i_data_len ); } else @@ -275,6 +313,11 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, p_pgrm->pp_es = realloc( p_pgrm->pp_es, p_pgrm->i_es_number * sizeof(es_descriptor_t *) ); + if( p_pgrm->pp_es == NULL ) + { + intf_ErrMsg( "Unable to realloc memory in input_AddES" ); + return NULL; + } p_pgrm->pp_es[p_pgrm->i_es_number - 1] = p_es; p_es->p_pgrm = p_pgrm; } @@ -317,6 +360,10 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) p_pgrm->pp_es = realloc( p_pgrm->pp_es, p_pgrm->i_es_number * sizeof(es_descriptor_t *)); + if( p_pgrm->pp_es == NULL ) + { + intf_ErrMsg( "Unable to realloc memory in input_DelES" ); + } break; } } @@ -344,6 +391,11 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) p_input->stream.pp_es = realloc( p_input->stream.pp_es, p_input->stream.i_es_number * sizeof(es_descriptor_t *)); + if( p_input->stream.pp_es == NULL ) + { + intf_ErrMsg( "Unable to realloc memory in input_DelES" ); + } + } #ifdef STATS @@ -425,7 +477,11 @@ static vdec_config_t * GetVdecConfig( input_thread_t * p_input, { vdec_config_t * p_config; - p_config = (vdec_config_t *)malloc( sizeof(vdec_config_t) ); + if( (p_config = (vdec_config_t *)malloc( sizeof(vdec_config_t) )) == NULL) + { + intf_ErrMsg( "Unable to allocate memory in GetVdecConfig" ); + return NULL; + } p_config->p_vout = p_input->p_default_vout; if( InitDecConfig( p_input, p_es, &p_config->decoder_config ) == -1 ) { @@ -444,7 +500,11 @@ static adec_config_t * GetAdecConfig( input_thread_t * p_input, { adec_config_t * p_config; - p_config = (adec_config_t *)malloc( sizeof(adec_config_t) ); + if ( (p_config = (adec_config_t *)malloc( sizeof(adec_config_t))) ==NULL ) + { + intf_ErrMsg( "Unable to allocate memory in GetAdecConfig" ); + return NULL; + } p_config->p_aout = p_input->p_default_aout; if( InitDecConfig( p_input, p_es, &p_config->decoder_config ) == -1 ) { @@ -532,6 +592,11 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) p_input->stream.pp_selected_es, p_input->stream.i_selected_es_number * sizeof(es_descriptor_t *) ); + if( p_input->stream.pp_selected_es == NULL ) + { + intf_ErrMsg( "Unable to realloc memory in input_SelectES" ); + return(-1); + } p_input->stream.pp_selected_es[p_input->stream.i_selected_es_number - 1] = p_es; } diff --git a/src/interface/intf_msg.c b/src/interface/intf_msg.c index dcb5b92ea2..b6b0e449c9 100644 --- a/src/interface/intf_msg.c +++ b/src/interface/intf_msg.c @@ -175,6 +175,9 @@ void intf_MsgDestroy( void ) } #endif + /* destroy lock */ + vlc_mutex_destroy( &p_main->p_msg->lock ); + /* Free structure */ free( p_main->p_msg ); } diff --git a/src/misc/modules.c b/src/misc/modules.c index 334e3a0cf9..ee771fe6af 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -174,6 +174,9 @@ void module_DestroyBank( module_bank_t * p_bank ) } } + /* Destory the lock */ + vlc_mutex_destroy( &p_bank->lock ); + /* We can free the module bank */ free( p_bank ); diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index ae0b331c1f..46d985e00a 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -708,6 +708,10 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type, intf_DbgMsg("picture %p (in free picture slot)", p_free_picture ); #endif vlc_mutex_unlock( &p_vout->picture_lock ); + + /* Initialize mutex */ + vlc_mutex_init( &(p_free_picture->lock_deccount) ); + return( p_free_picture ); } @@ -744,6 +748,10 @@ void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic ) #ifdef DEBUG_VOUT intf_DbgMsg("picture %p", p_pic); #endif + + /* destroy the lock that had been initialized in CreatePicture */ + vlc_mutex_destroy( &(p_pic->lock_deccount) ); + vlc_mutex_unlock( &p_vout->picture_lock ); } @@ -1311,6 +1319,11 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status ) vout_UnloadFont( p_vout->p_large_font ); p_vout->p_sys_destroy( p_vout ); + /* Destroy the locks */ + vlc_mutex_destroy( &p_vout->picture_lock ); + vlc_mutex_destroy( &p_vout->subpicture_lock ); + vlc_mutex_destroy( &p_vout->change_lock ); + /* Free structure */ free( p_vout ); *pi_status = i_status; diff --git a/src/video_parser/video_fifo.c b/src/video_parser/video_fifo.c index edf84d83bc..779e05ac1b 100644 --- a/src/video_parser/video_fifo.c +++ b/src/video_parser/video_fifo.c @@ -2,7 +2,7 @@ * video_fifo.c : video FIFO management ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_fifo.c,v 1.25 2001/01/05 18:46:45 massiot Exp $ + * $Id: video_fifo.c,v 1.26 2001/01/07 03:56:40 henri Exp $ * * Authors: Christophe Massiot <massiot@via.ecp.fr> * @@ -62,6 +62,7 @@ void vpar_InitFIFO( vpar_thread_t * p_vpar ) p_vpar->vfifo.p_vpar = p_vpar; #ifdef VDEC_SMP + /* Initialize mutex and cond */ vlc_mutex_init( &p_vpar->vfifo.lock ); vlc_cond_init( &p_vpar->vfifo.wait ); diff --git a/src/video_parser/video_parser.c b/src/video_parser/video_parser.c index 25f1f134f5..1d2212f715 100644 --- a/src/video_parser/video_parser.c +++ b/src/video_parser/video_parser.c @@ -2,7 +2,7 @@ * video_parser.c : video parser thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_parser.c,v 1.61 2001/01/05 18:46:45 massiot Exp $ + * $Id: video_parser.c,v 1.62 2001/01/07 03:56:40 henri Exp $ * * Authors: Christophe Massiot <massiot@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr> @@ -384,6 +384,16 @@ static void EndThread( vpar_thread_t *p_vpar ) #endif free( p_vpar->p_config ); + +#ifdef VDEC_SMP + /* Destroy lock and cond */ + vlc_mutex_destroy( &(p_vpar->vfifo.lock) ); + vlc_mutex_destroy( &(p_vpar->vbuffer.lock) ); + vlc_cond_destroy( &(p_vpar->vfifo.wait) ); +#endif + + vlc_mutex_destroy( &(p_vpar->synchro.fifo_lock) ); + free( p_vpar ); intf_DbgMsg("vpar debug: EndThread(%p)", p_vpar); diff --git a/src/video_parser/vpar_headers.c b/src/video_parser/vpar_headers.c index 3555e4a8b1..4c2d165835 100644 --- a/src/video_parser/vpar_headers.c +++ b/src/video_parser/vpar_headers.c @@ -2,7 +2,7 @@ * vpar_headers.c : headers parsing ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_headers.c,v 1.66 2001/01/05 18:46:45 massiot Exp $ + * $Id: vpar_headers.c,v 1.67 2001/01/07 03:56:40 henri Exp $ * * Authors: Christophe Massiot <massiot@via.ecp.fr> * St�phane Borel <stef@via.ecp.fr> @@ -698,7 +698,6 @@ static void PictureHeader( vpar_thread_t * p_vpar ) << ( 1 - p_vpar->picture.b_frame_structure )); P_picture->i_deccount = p_vpar->sequence.i_mb_size; - vlc_mutex_init( &p_vpar->picture.p_picture->lock_deccount ); #ifdef VDEC_SMP memset( p_vpar->picture.pp_mb, 0, MAX_MB*sizeof(macroblock_t *) ); #endif -- 2.25.4