]> git.sesse.net Git - mlt/commitdiff
Remove the tractor service locking.
authorDan Dennedy <dan@dennedy.org>
Fri, 11 Jun 2010 07:43:56 +0000 (00:43 -0700)
committerDan Dennedy <dan@dennedy.org>
Mon, 24 Jan 2011 02:09:43 +0000 (18:09 -0800)
This completely inhibited parallelism, but removing it also exposes more
race conditions that require resolution.

src/framework/mlt_consumer.c
src/framework/mlt_tractor.c

index fab880c15e698e1f35d4e95724d8d6b8eecc5aad..b6cc38630b6d4dabac84ef4d5b36ff3977c4c4d6 100644 (file)
@@ -641,7 +641,6 @@ static void *consumer_read_ahead_thread( void *arg )
        int64_t time_frame = 0;
        int64_t time_process = 0;
        int skip_next = 0;
-       mlt_service lock_object = NULL;
 
        if ( preview_off && preview_format != 0 )
                this->format = preview_format;
@@ -649,12 +648,6 @@ static void *consumer_read_ahead_thread( void *arg )
        // Get the first frame
        frame = mlt_consumer_get_frame( this );
 
-       // Get the lock object
-       lock_object = mlt_properties_get_data( MLT_FRAME_PROPERTIES( frame ), "consumer_lock_service", NULL );
-
-       // Lock it
-       if ( lock_object ) mlt_service_lock( lock_object );
-
        // Get the image of the first frame
        if ( !video_off )
        {
@@ -668,9 +661,6 @@ static void *consumer_read_ahead_thread( void *arg )
                mlt_frame_get_audio( frame, &audio, &afmt, &frequency, &channels, &samples );
        }
 
-       // Unlock the lock object
-       if ( lock_object ) mlt_service_unlock( lock_object );
-
        // Mark as rendered
        mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 );
 
@@ -702,15 +692,9 @@ static void *consumer_read_ahead_thread( void *arg )
                if ( frame == NULL )
                        continue;
 
-               // Attempt to fetch the lock object
-               lock_object = mlt_properties_get_data( MLT_FRAME_PROPERTIES( frame ), "consumer_lock_service", NULL );
-
                // Increment the count
                count ++;
 
-               // Lock if there's a lock object
-               if ( lock_object ) mlt_service_lock( lock_object );
-
                // All non normal playback frames should be shown
                if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "_speed" ) != 1 )
                {
@@ -770,9 +754,6 @@ static void *consumer_read_ahead_thread( void *arg )
                        if ( ( ( time_wait + time_frame + time_process ) / count ) > frame_duration )
                                skip_next = 1;
                }
-
-               // Unlock if there's a lock object
-               if ( lock_object ) mlt_service_unlock( lock_object );
        }
 
        // Remove the last frame
@@ -824,7 +805,6 @@ static void *consumer_worker_thread( void *arg )
        // General frame variable
        mlt_frame frame = NULL;
        uint8_t *image = NULL;
-       mlt_service lock_object = NULL;
 
        if ( preview_off && preview_format != 0 )
                this->format = preview_format;
@@ -837,12 +817,6 @@ static void *consumer_worker_thread( void *arg )
        pthread_cond_signal( &this->frame_queue_cond );
        pthread_mutex_unlock( &this->frame_queue_mutex );
 
-       // Get the lock object
-       lock_object = mlt_properties_get_data( MLT_FRAME_PROPERTIES( frame ), "consumer_lock_service", NULL );
-
-       // Lock it
-       if ( lock_object ) mlt_service_lock( lock_object );
-
        // Get the image of the first frame
        if ( !video_off )
        {
@@ -856,9 +830,6 @@ static void *consumer_worker_thread( void *arg )
                mlt_frame_get_audio( frame, &audio, &afmt, &frequency, &channels, &samples );
        }
 
-       // Unlock the lock object
-       if ( lock_object ) mlt_service_unlock( lock_object );
-
        // Mark as rendered
        mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 );
 
@@ -890,12 +861,6 @@ static void *consumer_worker_thread( void *arg )
                if ( frame == NULL )
                        continue;
 
-               // Attempt to fetch the lock object
-               lock_object = mlt_properties_get_data( MLT_FRAME_PROPERTIES( frame ), "consumer_lock_service", NULL );
-
-               // Lock if there's a lock object
-               if ( lock_object ) mlt_service_lock( lock_object );
-
                // All non normal playback frames should be shown
                if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "_speed" ) != 1 )
                {
@@ -918,9 +883,6 @@ static void *consumer_worker_thread( void *arg )
                        samples = mlt_sample_calculator( fps, frequency, counter++ );
                        mlt_frame_get_audio( frame, &audio, &afmt, &frequency, &channels, &samples );
                }
-
-               // Unlock if there's a lock object
-               if ( lock_object ) mlt_service_unlock( lock_object );
        }
 
        // Remove the last frame
index 1a1ca9010c8460fc612e2423a54d7cb491570b86..25bd0d320b69dafab0dc1aa5a5b4a09378aaf077 100644 (file)
@@ -514,7 +514,6 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                        mlt_frame_set_position( *frame, mlt_producer_frame( parent ) );
                        mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "test_audio", audio == NULL );
                        mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "test_image", video == NULL );
-                       mlt_properties_set_data( MLT_FRAME_PROPERTIES( *frame ), "consumer_lock_service", this, 0, NULL, NULL );
                }
                else if ( producer != NULL )
                {