]> git.sesse.net Git - mlt/commitdiff
Fix intermitent crash in mlt_consumer consumer_read_ahead_thread.
authorDan Dennedy <dan@dennedy.org>
Fri, 22 Apr 2011 23:08:22 +0000 (16:08 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 22 Apr 2011 23:08:22 +0000 (16:08 -0700)
src/framework/mlt_consumer.c

index 418c11994c8a4209f198f3f9c4429a411c91686c..8538e56ed91daa8fe03db9165252c3dfa8dad620 100644 (file)
@@ -648,21 +648,24 @@ static void *consumer_read_ahead_thread( void *arg )
        // Get the first frame
        frame = mlt_consumer_get_frame( self );
 
-       // Get the image of the first frame
-       if ( !video_off )
+       if ( frame )
        {
-               mlt_events_fire( MLT_CONSUMER_PROPERTIES( self ), "consumer-frame-render", frame, NULL );
-               mlt_frame_get_image( frame, &image, &self->format, &width, &height, 0 );
-       }
+               // Get the image of the first frame
+               if ( !video_off )
+               {
+                       mlt_events_fire( MLT_CONSUMER_PROPERTIES( self ), "consumer-frame-render", frame, NULL );
+                       mlt_frame_get_image( frame, &image, &self->format, &width, &height, 0 );
+               }
 
-       if ( !audio_off )
-       {
-               samples = mlt_sample_calculator( fps, frequency, counter++ );
-               mlt_frame_get_audio( frame, &audio, &afmt, &frequency, &channels, &samples );
-       }
+               if ( !audio_off )
+               {
+                       samples = mlt_sample_calculator( fps, frequency, counter++ );
+                       mlt_frame_get_audio( frame, &audio, &afmt, &frequency, &channels, &samples );
+               }
 
-       // Mark as rendered
-       mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 );
+               // Mark as rendered
+               mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 );
+       }
 
        // Get the starting time (can ignore the times above)
        gettimeofday( &ante, NULL );