]> git.sesse.net Git - mlt/commitdiff
Return firing consumer-thread-stopped to the render thread.
authorDan Dennedy <dan@dennedy.org>
Tue, 31 Dec 2013 19:22:26 +0000 (11:22 -0800)
committerDan Dennedy <dan@dennedy.org>
Tue, 31 Dec 2013 19:22:26 +0000 (11:22 -0800)
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.

src/framework/mlt_consumer.c

index 74b946d403641d0f5a48d4633dd26c743fb43580..24dd0d0cc38090ad7a35660e0b27ce7947c9c556 100644 (file)
@@ -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 );
        }
 }