From: Dan Dennedy Date: Fri, 11 Jun 2010 07:43:56 +0000 (-0700) Subject: Remove the tractor service locking. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=3d005638ded294df09d14d11f4fb0f5ae54a7f96;p=mlt Remove the tractor service locking. This completely inhibited parallelism, but removing it also exposes more race conditions that require resolution. --- diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index fab880c1..b6cc3863 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -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 diff --git a/src/framework/mlt_tractor.c b/src/framework/mlt_tractor.c index 1a1ca901..25bd0d32 100644 --- a/src/framework/mlt_tractor.c +++ b/src/framework/mlt_tractor.c @@ -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 ) {