From: lilo_booter Date: Wed, 5 May 2004 17:58:34 +0000 (+0000) Subject: yet another sdl tweak (sigh) X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=2e354c12a6ae418b3bf3c526b3370b98a717f70b;p=melted yet another sdl tweak (sigh) git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@305 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/modules/sdl/consumer_sdl.c b/src/modules/sdl/consumer_sdl.c index 23f1bd9..b066393 100644 --- a/src/modules/sdl/consumer_sdl.c +++ b/src/modules/sdl/consumer_sdl.c @@ -41,7 +41,7 @@ struct consumer_sdl_s mlt_deque queue; pthread_t thread; int running; - uint8_t audio_buffer[ 4096 * 19 ]; + uint8_t audio_buffer[ 4096 * 10 ]; int audio_avail; pthread_mutex_t audio_mutex; pthread_cond_t audio_cond; @@ -497,6 +497,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) if ( this->sdl_screen != NULL && this->sdl_overlay != NULL ) { this->buffer = this->sdl_overlay->pixels[ 0 ]; + sdl_lock_display(); if ( SDL_LockYUVOverlay( this->sdl_overlay ) >= 0 ) { if ( image != NULL ) @@ -504,6 +505,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) SDL_UnlockYUVOverlay( this->sdl_overlay ); SDL_DisplayYUVOverlay( this->sdl_overlay, &this->sdl_screen->clip_rect ); } + sdl_unlock_display(); } } @@ -523,7 +525,6 @@ static void *video_thread( void *arg ) mlt_frame next = NULL; mlt_properties properties = NULL; double speed = 0; - int skipped = 0; // Get the current time gettimeofday( &now, NULL ); @@ -561,7 +562,7 @@ static void *video_thread( void *arg ) mlt_position difference = scheduled - elapsed; // Smooth playback a bit - if ( difference > 20000 && speed == 1.0 ) + if ( difference > 10000 && speed == 1.0 ) { tm.tv_sec = difference / 1000000; tm.tv_nsec = ( difference % 1000000 ) * 500; @@ -571,11 +572,9 @@ static void *video_thread( void *arg ) // Show current frame if not too old if ( difference > -10000 || speed != 1.0 || mlt_deque_count( this->queue ) < 2 ) consumer_play_video( this, next ); - else - skipped ++; // If the queue is empty, recalculate start to allow build up again - if ( mlt_deque_count( this->queue ) == 0 ) + if ( mlt_deque_count( this->queue ) == 0 && speed == 1.0 ) { gettimeofday( &now, NULL ); start = ( ( int64_t )now.tv_sec * 1000000 + now.tv_usec ) - scheduled + 20000;