From: Dan Dennedy Date: Fri, 4 Oct 2013 06:16:30 +0000 (-0700) Subject: Always init pthread mutexes regardless if locking. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=40710bc06183d9cd12f9f224f1b40e58d81d8d8b;p=mlt Always init pthread mutexes regardless if locking. --- diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index b09eb1d0..a0edb123 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -660,17 +660,18 @@ static int producer_open( producer_avformat self, mlt_profile profile, const cha int error = 0; mlt_properties properties = MLT_PRODUCER_PROPERTIES( self->parent ); + if ( !self->is_mutex_init ) + { + pthread_mutex_init( &self->audio_mutex, NULL ); + pthread_mutex_init( &self->video_mutex, NULL ); + pthread_mutex_init( &self->packets_mutex, NULL ); + pthread_mutex_init( &self->open_mutex, NULL ); + self->is_mutex_init = 1; + } + // Lock the service if ( take_lock ) { - if ( !self->is_mutex_init ) - { - pthread_mutex_init( &self->audio_mutex, NULL ); - pthread_mutex_init( &self->video_mutex, NULL ); - pthread_mutex_init( &self->packets_mutex, NULL ); - pthread_mutex_init( &self->open_mutex, NULL ); - self->is_mutex_init = 1; - } pthread_mutex_lock( &self->audio_mutex ); pthread_mutex_lock( &self->video_mutex ); }