Fixed timing problem in streaming.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@817 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2004-02-06 09:21:57 +00:00
parent 15212b2139
commit ffa911adb5
1 changed files with 3 additions and 2 deletions

View File

@ -394,11 +394,12 @@ void Event::StreamEvent( int event_id, int rate, int scale, FILE *fd )
{ {
if ( rate ) if ( rate )
{ {
double this_delta = atof(dbrow[2]);
if ( i ) if ( i )
{ {
gettimeofday( &now, &dummy_tz ); gettimeofday( &now, &dummy_tz );
double frame_delta = atof(dbrow[3])-last_delta; double frame_delta = this_delta-last_delta;
DELTA_TIMEVAL( delta_time, now, last_now, DT_PREC_6 ); DELTA_TIMEVAL( delta_time, now, last_now, DT_PREC_6 );
int delay = (int)((DT_GRAN_1000000*frame_delta))-delta_time.delta; int delay = (int)((DT_GRAN_1000000*frame_delta))-delta_time.delta;
@ -412,7 +413,7 @@ void Event::StreamEvent( int event_id, int rate, int scale, FILE *fd )
if ( delay > 0 ) if ( delay > 0 )
usleep( delay ); usleep( delay );
} }
last_delta = atof(dbrow[3]); last_delta = this_delta;
gettimeofday( &last_now, &dummy_tz ); gettimeofday( &last_now, &dummy_tz );
} }
static char filepath[PATH_MAX]; static char filepath[PATH_MAX];