From: Dan Dennedy Date: Tue, 31 Dec 2013 19:22:26 +0000 (-0800) Subject: Return firing consumer-thread-stopped to the render thread. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=60c41cb94a1001dc2b259c6ac024558db3939ed7;p=mlt Return firing consumer-thread-stopped to the render thread. This is for OpenGL support, where an app event listener expects to receive this on the rendering thread to which a specific GL context is bound. --- diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index 74b946d4..24dd0d0c 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -913,6 +913,18 @@ static void *consumer_read_ahead_thread( void *arg ) // Remove the last frame mlt_frame_close( frame ); + // Wipe the queue + pthread_mutex_lock( &priv->queue_mutex ); + while ( mlt_deque_count( priv->queue ) ) + mlt_frame_close( mlt_deque_pop_back( priv->queue ) ); + + // Close the queue + mlt_deque_close( priv->queue ); + priv->queue = NULL; + pthread_mutex_unlock( &priv->queue_mutex ); + + mlt_events_fire( MLT_CONSUMER_PROPERTIES(self), "consumer-thread-stopped", NULL ); + return NULL; } @@ -1201,15 +1213,6 @@ static void consumer_read_ahead_stop( mlt_consumer self ) // Destroy the condition pthread_cond_destroy( &priv->queue_cond ); - - // Wipe the queue - while ( mlt_deque_count( priv->queue ) ) - mlt_frame_close( mlt_deque_pop_back( priv->queue ) ); - - // Close the queue - mlt_deque_close( priv->queue ); - - mlt_events_fire( MLT_CONSUMER_PROPERTIES(self), "consumer-thread-stopped", NULL ); } }