kerberos-io / agent

An open and scalable video surveillance system for anyone making this world a better and more peaceful place.
https://kerberos.io
MIT License
642 stars 78 forks source link

Fix prerecording timing #43

Closed olokos closed 1 year ago

olokos commented 1 year ago

With this change, the prerecording time is actually working as expected, with prerecording delay, then motion then postrecording delay.

Since motionCursor := queue.Latest() was used, the prerecording delay was counted since the last frame received, instead of the first frame for this motion event.

Changing it back to motionCursor := queue.Oldest() actually allowed to get video data before the motion event happened, not right after it happened.

olokos commented 1 year ago

Perhaps this +1 could also be removed? https://github.com/olokos/agent/commit/68f1de2dbf8629045983185d5b885b4b235be020#diff-ad807fb60a10245531d9853ad52927d87ea197e7bebd72d762085f168ad6b529R96

cedricve commented 1 year ago

lets merge, still strange as would expect to trigger motion faster, and recording start older looks like this queue (https://github.com/kerberos-io/joy4/blob/master/av/pubsub/queue.go#L12-L21) is not working as expect. Merging again as tests showed this is working. Still not expected from my reasoning.