"Time To Next Event = 1 Second" Problem, Cause and Solution

Forum for questions and support relating to the 1.24.x releases only.
Locked
Patrick-2012
Posts: 4
Joined: Mon Feb 06, 2012 3:58 pm

"Time To Next Event = 1 Second" Problem, Cause and Solution

Post by Patrick-2012 »

Hello All. This is my first post here and I wanted to share something that vexed me for a while, largely because I could find no information online. So I'll add it here and hope it becomes part of the record for others.

Problem: Selecting to replay an event causes the first few frames of the event to play, but then the screen goes black with a single line of text that reads "Time to Next Event = 1 Seconds".

Diagnosis: Nothing in the FAQ, Google, Wiki or anywhere else. Logs showed nothing out of normal. I had to go into the code.

Code of zm_event.cpp shows that as frame data is pulled from the DB, each frame time is evaluated for its delta against the time of the event. In other words, it is looking to see how far away the frame is from the event. If the event time delta is a negative value (before the event) that rounds greater than 1, then the code calls for the replay to stop and terminate with the message noted above. I dug into the database and found the Frames.Delta column and played with some events. Sure enough, if the value of "Delta" is less than -0.50 the stream will stop (there is some rounding going on). If I modified the values of Delta accordingly, the full event would play back in my viewer. FWIW, you can see the actual Delta values yourself in your web browser by selecting "Frames" from the event replay window.

Solution: I caused this issue by increasing the pre-event image count to 60 in the Source configuration box under "Buffers". Reducing this to 15 got rid of the problem. My goal was to get a 2-second pre-event view in the recording. I obviously cannot do it this way.

Thoughts: This is an odd bit of condition checking. All the frames of an event (and the frames before the event) are actually recorded and available for viewing. But the code won't allow too many frames before the event to be played - it actually terminates the replay. I find this odd and not desired. If I have frames to watch, the system should let me view them. I asked for them, right?

I could easily modify this code to dump the check. It could be a one-line "fix", but then I need to build the software instead of just using the binaries I got via yum. I write software for a living and don't want to be outside the mainline distribution. I suspect there is some magic set of configurable options to do what I want without encountering this issue. I also imagine someone had a reason to put this code in there. If it is the case it should not exist, then I would happily send in a short code patch to disable the function, if requested. Just let me know. My binary version is: zoneminder-1.24.2-6.fc14.x86_64

In the meantime, if someone can tell me what I did wrong - or better yet, how to do it right - please share with me if you have the time.

Hope this helps someone. Thanks to the community for making a good product.
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: "Time To Next Event = 1 Second" Problem, Cause and Solut

Post by bb99 »

I've used phpmyadmin to repair the database; works everytime. So does the command line string given in the wiki. I believe there is a more perminate cure using Innodb posted which is not prone to these issues.
eug
Posts: 32
Joined: Wed Mar 14, 2007 5:50 am

Re: "Time To Next Event = 1 Second" Problem, Cause and Solut

Post by eug »

Hi,
I have this Time To Next Event = 1 problem too. The first frame is displayed and the video window goes black with that text.
I've repaired the database with mysqlcheck after stopping zoneminder but it didn't help.

Is there a fix that doesn't require recompiling? My pre-event image count is 40. I have 7 cameras on Zoneminder 1.24.3.

The forum won't let me search for the error message as the words are too common. Heh.

Thanks!

edit: I fixed it by changing pre-event image count to 35, as mentioned in this other post I came across:
http://www.zoneminder.com/forums/viewto ... 21&t=19309
Locked