]> git.sesse.net Git - mlt/commitdiff
Always init pthread mutexes regardless if locking.
authorDan Dennedy <dan@dennedy.org>
Fri, 4 Oct 2013 06:16:30 +0000 (23:16 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 4 Oct 2013 06:16:30 +0000 (23:16 -0700)
src/modules/avformat/producer_avformat.c

index b09eb1d0f33abda2d69dc9846b5a146794a3415e..a0edb123d70f54deebfa8bd05ae63000946e57ca 100644 (file)
@@ -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 );
        }