]> git.sesse.net Git - mlt/commitdiff
Revert "move mutex and deque initialization to producer init method"
authorDan Dennedy <dan@dennedy.org>
Sat, 22 Dec 2012 18:37:32 +0000 (10:37 -0800)
committerDan Dennedy <dan@dennedy.org>
Sat, 22 Dec 2012 18:37:32 +0000 (10:37 -0800)
This reverts commit 59d8632607ffe5caa49c83f8209be627557a1474.

src/modules/avformat/producer_avformat.c

index 6b286f796ed90b5ae5d42c050f38587cb154ad52..ab8df1c99bbfb054acf002d63b5fef4661d512f2 100644 (file)
@@ -194,16 +194,6 @@ 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
@@ -840,6 +830,10 @@ 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 );
        }
@@ -956,6 +950,11 @@ 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 )
        {