ZM 1.23.3 FastForwarding fix

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

ZM 1.23.3 FastForwarding fix

Post by timcraig »

ZM 1.23.x fast forwarding seems crippled. To get fast forwarding to work at all, I had to have the ZM_WEB_<H or M or L>_VIDEO_MAXFPS option for the bandwidth profile I was using to be close my monitors max frame rate. Since I have I monitors with different max frame rates, this wasn't a good solution. On top of that, the fast forwarding seemed to only work by skipping frames opposed instead of speeding up the frame rate. Back in ZM 1.22.x fast forwarding seemed fine.


I looked at the code and got fast forwarding to work much like ZM 1.22.x. I haven't tested this on mpeg streaming yet.

Here is the patch:

Code: Select all

--- zm_event.cpp	2008-04-21 06:52:05.000000000 -0700
+++ zm_event.cpp	2008-08-12 22:26:50.000000000 -0700
@@ -1213,8 +1213,10 @@ void EventStream::runStream()
             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;
+                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;
             }
         }

edit:
Opps, I discovered an issue if you have a low M_WEB_<H or M or L>_VIDEO_MAXFPS setting. Rewinding rewinds way to fast. I'll look into this some more when I have some time. This might not be an issue over a low bandwidth connection.

2nd edit: I fixed the problem, I edited the patch above.
Last edited by timcraig on Thu Aug 14, 2008 2:46 am, edited 1 time in total.
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

Oh man, I think I know why rewinding is faster than it should be. The line

Code: Select all

delta_us = (delta_us*ZM_RATE_BASE)/replay_rate
needs to be

Code: Select all

delta_us = (delta_us*ZM_RATE_BASE)/abs(replay_rate)

That's what happens when you play with code when you're half asleep.
I'll try to change out tonight and update my patch if everything works out okay.
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

I was correct, using abs(replay_rate) did the trick. I updated the patch in the op. If you already applied the patch the old patch, you can undo it and apply this new patch or simply edit the file in the way I described above.
Last edited by timcraig on Thu Aug 14, 2008 3:59 pm, edited 1 time in total.
agoodm
Posts: 52
Joined: Tue Oct 09, 2007 12:16 pm

Post by agoodm »

Patch in the OP wont apply for me now. So I went into zm_event.cpp and used search and replace.
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

agoodm,

It probably didn't work for you because you might have applied the older patch. The new modified patch has for a clean ZoneMinder 1.23.3 source. Sorry about that.
Post Reply