Mutex protection on put frame close
[melted] / src / framework / mlt_consumer.c
index 2020096..6c85988 100644 (file)
@@ -599,6 +599,11 @@ int mlt_consumer_stop( mlt_consumer this )
 
        // Just in case...
        pthread_mutex_lock( &this->put_mutex );
+       if ( this->put != NULL )
+       {
+               mlt_frame_close( this->put );
+               this->put = NULL;
+       }
        pthread_cond_broadcast( &this->put_cond );
        pthread_mutex_unlock( &this->put_mutex );
 
@@ -609,12 +614,6 @@ int mlt_consumer_stop( mlt_consumer this )
        if ( mlt_properties_get( properties, "post" ) )
                system( mlt_properties_get( properties, "post" ) );
 
-       if ( this->put != NULL )
-       {
-               mlt_frame_close( this->put );
-               this->put = NULL;
-       }
-
        return 0;
 }