]> git.sesse.net Git - mlt/commitdiff
move mutex and deque initialization to producer init method
authorMaksym Veremeyenko <verem@m1stereo.tv>
Thu, 19 Jul 2012 10:23:09 +0000 (13:23 +0300)
committerDan Dennedy <dan@dennedy.org>
Fri, 20 Jul 2012 05:50:55 +0000 (22:50 -0700)
src/modules/avformat/producer_avformat.c

index 8b327c374a25f1707d4b23afaaa7dfe543f218b5..d93ed29fab0002ad42e9b185b1aef9964a47d54b 100644 (file)
@@ -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 )
        {