Hi Dan,
I have fixed the *sdl_preview* consumer to not crash when connecting a new
producer without first stopping the consumer.  Please take a look at the
.patch and let me know what you think.

Also, I tested out the new *wait_for('consumer-sdl-paused')* method, and it
would just freeze OpenShot.
When I debugged into the MLT code, it was hanging on the following line of
code:

mlt_events.c (line 438):
*pthread_cond_wait( *&pair->cond, &pair->mutex* )*;

Any thoughts on this one?

Thanks!
-Jonathan
diff --git a/src/modules/sdl/consumer_sdl_preview.c b/src/modules/sdl/consumer_sdl_preview.c
index 73df2e5..4a2db79 100644
--- a/src/modules/sdl/consumer_sdl_preview.c
+++ b/src/modules/sdl/consumer_sdl_preview.c
@@ -276,7 +276,8 @@ static void *consumer_thread( void *arg )
 
 	// Get the consumer and producer
 	mlt_consumer consumer = &this->parent;
-	mlt_producer producer = MLT_PRODUCER( mlt_service_get_producer( MLT_CONSUMER_SERVICE( consumer ) ) );
+	mlt_service consumer_service = MLT_CONSUMER_SERVICE( consumer );
+	mlt_producer producer = MLT_PRODUCER( mlt_service_get_producer( consumer_service ) );
 
 	// Get the properties
 	mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
@@ -306,7 +307,7 @@ static void *consumer_thread( void *arg )
 			double speed = mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ), "_speed" );
 
 			// Lock during the operation
-			mlt_service_lock( MLT_CONSUMER_SERVICE( consumer ) );
+			mlt_service_lock( consumer_service );
 
 			// Get refresh request for the current frame
 			int refresh = mlt_properties_get_int( properties, "refresh" );
@@ -317,7 +318,7 @@ static void *consumer_thread( void *arg )
 			mlt_events_unblock( properties, properties );
 
 			// Unlock after the operation
-			mlt_service_unlock( MLT_CONSUMER_SERVICE( consumer ) );
+			mlt_service_unlock( consumer_service );
 
 			// Set the changed property on this frame for the benefit of still
 			mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "refresh", refresh );
@@ -341,6 +342,8 @@ static void *consumer_thread( void *arg )
 			// If we aren't playing normally, then use the still
 			if ( speed != 1 )
 			{
+				// Always get the producer (since it might change)
+				producer = MLT_PRODUCER( mlt_service_get_producer( consumer_service ) );
 				mlt_position duration = mlt_producer_get_playtime( producer );
 				int pause = 0;
 
@@ -419,12 +422,12 @@ static void *consumer_thread( void *arg )
 			if ( this->running && preview_off == 0 )
 			{
 				mlt_properties active = MLT_CONSUMER_PROPERTIES( this->active );
-				mlt_service_lock( MLT_CONSUMER_SERVICE( consumer ) );
+				mlt_service_lock( consumer_service );
 				mlt_properties_set_int( properties, "rect_x", mlt_properties_get_int( active, "rect_x" ) );
 				mlt_properties_set_int( properties, "rect_y", mlt_properties_get_int( active, "rect_y" ) );
 				mlt_properties_set_int( properties, "rect_w", mlt_properties_get_int( active, "rect_w" ) );
 				mlt_properties_set_int( properties, "rect_h", mlt_properties_get_int( active, "rect_h" ) );
-				mlt_service_unlock( MLT_CONSUMER_SERVICE( consumer ) );
+				mlt_service_unlock( consumer_service );
 			}
 
 			if ( this->active == this->still )
------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages, 
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev 
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to