From fa5db09a734057ed251aea065622b6a69bcc194c Mon Sep 17 00:00:00 2001 From: stan Date: Wed, 1 Apr 2009 19:39:23 +0000 Subject: [PATCH] FIxed issues with negative FPS affecting streaming. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2839 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm_monitor.cpp | 5 +++++ web/ajax/stream.php | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 6de0e0ef2..839bdacd6 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -685,6 +685,11 @@ double Monitor::GetFPS() const 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 ); } diff --git a/web/ajax/stream.php b/web/ajax/stream.php index ece137901..50a400169 100644 --- a/web/ajax/stream.php +++ b/web/ajax/stream.php @@ -1,6 +1,6 @@ 0 ) { 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 ) )