Page 1 of 1

ZM 1.24.1 FastForwarding fix

Posted: Sun Apr 05, 2009 8:19 am
by timcraig
This is a similar patch I made for Zoneminder 1.23.3 (http://www.zoneminder.com/forums/viewtopic.php?t=12111).

Fast forwarding/rewinding was very slow if your view events recorded in a low frame rate while you have a high frame rate set in the bandwidth options (WEB_H_VIDEO_MAXFPS, WEB_M_VIDEO_MAXFPS, or WEB_L_VIDEO_MAXFPS). On top of being slow, fast forwarding and rewinding tended to excessively skip frames which makes it really easy to skip over something important.

The patch bellow makes improves the fast-forward/rewind while only skipping frames when the playback speed X event FPS exceeds your bandwidth frame rate limit.

Code: Select all

Index: src/zm_event.cpp
===================================================================
--- src/zm_event.cpp	(revision 2846)
+++ src/zm_event.cpp	(working copy)
@@ -1327,10 +1327,12 @@
             // If we are streaming and this frame is due to be sent
             if ( ((curr_frame_id-1)%frame_mod) == 0 )
             {
-                delta_us = (unsigned int)(frame_data->delta * 1000000);
-                if ( effective_fps < base_fps )
-                    delta_us = (delta_us * base_fps)/effective_fps;
-                send_frame = true;
+               delta_us = (unsigned int)(frame_data->delta * 1000000);
+               if ( replay_rate != ZM_RATE_BASE )
+                  delta_us = (delta_us*ZM_RATE_BASE)/abs(replay_rate);
+               if( frame_mod > 1 )
+                  delta_us *= frame_mod;
+               send_frame = true;
             }
         }
         else if ( step != 0 )