If your ZM's DVR controls and progress isn't broken when watching an event in mpeg streaming mode, don't use this fix. I made this thread to help people suffering from the same problem i had, as described in this thread.
When viewing an event, the DVR controls (play, pause, slow rev, etc) were broken for me, they did nothing. And the progress indicator was far off, 2 seconds into the event, it already showed progress at like 47 seconds, and within about 30 seconds to the event, the progress showed 10 min (end of video).
After some debugging, i realized that the streaming type ZM uses is buffered, it plays at your FPS setting, but ZM wasn't sending frames to it at your FPS rate, but rather at over 50+ frames/second, which is why the controls weren't working for me and the progress was far off.
I'm not sure if others are suffering from this aswell, but i got it to work properly by changing some of the code.
I told it to sleep always when not paused, and at a calculated rate (line borrowed from zm_monitor.cpp) based on the replay rate. 5 fps at normal replay rate means 200 milliseconds between frames, giving us 5 fps/second.
In file src/zm_event.cpp, change the following which starts at around line 1360 (May vary from installation to installation):
Code: Select all
if ( !paused )
{
curr_frame_id += replay_rate>0?1:-1;
if ( send_frame && type != STREAM_MPEG )
{
Debug( 3, "dUs: %d", delta_us );
usleep( delta_us );
}
}
Code: Select all
if ( !paused )
{
curr_frame_id += replay_rate>0?1:-1;
usleep((unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate))));
}
NOTE: When playing the video at high replay rate, the video may lag a little e.g. progress shows 5:30 min but actual video shows 4:50 min, video barely catching up with high replay rate.
I fixed that by going into Options and setting the maxfps for streaming for High,Medium and Low to my capture fps (5 in my case) and now its working perfectly.
mastertheknife.