From: Maksym Veremeyenko Date: Thu, 19 Jul 2012 10:23:09 +0000 (+0300) Subject: move mutex and deque initialization to producer init method X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=59d8632607ffe5caa49c83f8209be627557a1474;p=mlt move mutex and deque initialization to producer init method --- diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 8b327c37..d93ed29f 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -191,6 +191,16 @@ mlt_producer producer_avformat_init( mlt_profile profile, const char *service, c // Register our get_frame implementation producer->get_frame = producer_get_frame; + // init mutexes + 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 ); + + // init queues + self->apackets = mlt_deque_init(); + self->vpackets = mlt_deque_init(); + if ( strcmp( service, "avformat-novalidate" ) ) { // Open the file @@ -828,10 +838,6 @@ static int producer_open( producer_avformat self, mlt_profile profile, const cha // Lock the service if ( take_lock ) { - 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 ); pthread_mutex_lock( &self->audio_mutex ); pthread_mutex_lock( &self->video_mutex ); } @@ -948,11 +954,6 @@ static int producer_open( producer_avformat self, mlt_profile profile, const cha } if ( filename ) free( filename ); - if ( !error ) - { - self->apackets = mlt_deque_init(); - self->vpackets = mlt_deque_init(); - } if ( self->dummy_context ) {