X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fsdl%2Fconsumer_sdl_preview.c;h=cb2e33c59eba7a1cfe050168fe2f1fd8e35ba7a9;hb=df1a6457d0270cc8156b38c59b7479d415847551;hp=cfb6c0ebbab6e8c7495b96240a4ef0969909da1e;hpb=f00476101550ec7d8e863f6516aa83bc1b524570;p=melted diff --git a/src/modules/sdl/consumer_sdl_preview.c b/src/modules/sdl/consumer_sdl_preview.c index cfb6c0e..cb2e33c 100644 --- a/src/modules/sdl/consumer_sdl_preview.c +++ b/src/modules/sdl/consumer_sdl_preview.c @@ -178,6 +178,7 @@ static void *consumer_thread( void *arg ) // internal intialization int first = 1; mlt_frame frame = NULL; + int last_position = -1; // properties mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); @@ -256,6 +257,18 @@ static void *consumer_thread( void *arg ) // Make sure the recipient knows that this frame isn't really rendered mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 0 ); + // Optimisation to reduce latency + if ( speed == 1.0 ) + { + if ( last_position != -1 && last_position + 1 != mlt_frame_get_position( frame ) ) + mlt_consumer_purge( this->play ); + last_position = mlt_frame_get_position( frame ); + } + else + { + last_position = -1; + } + // If we're not the first frame and both consumers are stopped, then stop ourselves if ( !first && mlt_consumer_is_stopped( this->play ) && mlt_consumer_is_stopped( this->still ) ) {