FIxed issues with negative FPS affecting streaming.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2839 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2009-04-01 19:39:23 +00:00
parent 1edb48f358
commit fa5db09a73
2 changed files with 11 additions and 2 deletions

View File

@ -685,6 +685,11 @@ double Monitor::GetFPS() const
double curr_fps = image_count/time_diff; double curr_fps = image_count/time_diff;
if ( curr_fps < 0.0 )
{
//Error( "Negative FPS %f, time_diff = %lf (%d:%ld.%ld - %d:%ld.%ld), ibc: %d", curr_fps, time_diff, index2, time2.tv_sec, time2.tv_usec, index1, time1.tv_sec, time1.tv_usec, image_buffer_count );
return( 0.0 );
}
return( curr_fps ); return( curr_fps );
} }

View File

@ -1,6 +1,6 @@
<?php <?php
define( "MSG_TIMEOUT", 2.0 ); define( "MSG_TIMEOUT", 5.0 );
define( "MSG_DATA_SIZE", 4+256 ); define( "MSG_DATA_SIZE", 4+256 );
if ( !($_REQUEST['connkey'] && $_REQUEST['command']) ) if ( !($_REQUEST['connkey'] && $_REQUEST['command']) )
@ -57,13 +57,17 @@ $eSockets = NULL;
$numSockets = @socket_select( $rSockets, $wSockets, $eSockets, MSG_TIMEOUT ); $numSockets = @socket_select( $rSockets, $wSockets, $eSockets, MSG_TIMEOUT );
if ( $numSockets === false) if ( $numSockets === false)
{
ajaxError( "socket_select failed: ".socket_strerror(socket_last_error()) );
}
else if ( $numSockets == 0 )
{ {
ajaxError( "Timed out waiting for msg" ); ajaxError( "Timed out waiting for msg" );
} }
else if ( $numSockets > 0 ) else if ( $numSockets > 0 )
{ {
if ( count($rSockets) != 1 ) if ( count($rSockets) != 1 )
ajaxError( "Bogus return from select" ); ajaxError( "Bogus return from select, ".count($rSockets)." sockets available" );
} }
switch( $nbytes = @socket_recvfrom( $socket, $msg, MSG_DATA_SIZE, 0, $remSockFile ) ) switch( $nbytes = @socket_recvfrom( $socket, $msg, MSG_DATA_SIZE, 0, $remSockFile ) )