Skip to content

Fix ONVIF recordings stopping at section_length boundary despite active trigger#4588

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-recordings-continuation-issue
Draft

Fix ONVIF recordings stopping at section_length boundary despite active trigger#4588
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-recordings-continuation-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

ONVIF-triggered recordings in RECORDING_ONMOTION mode stop when events reach section_length, even when the ONVIF alarm remains active. Expected: recordings continue in a new event until trigger clears.

Root Cause

Event opening logic only checked state == ALARM, but ONVIF triggers set onvif->isAlarmed() independently. When an event closes at section_length, the monitor state may not be ALARM yet, preventing new event creation despite active external trigger.

// Before: only opens event if state == ALARM
if ((shared_data->recording == RECORDING_ONMOTION) and (state == ALARM))

// After: also checks external trigger state
if (shared_data->recording == RECORDING_ONMOTION) {
  bool external_trigger_active = (onvif and onvif->isAlarmed()) or 
                                 (Amcrest_Manager and Amcrest_Manager->isAlarmed());
  should_record = (state == ALARM) or external_trigger_active;
}

Changes

  • src/zm_monitor.cpp: Check onvif->isAlarmed() and Amcrest_Manager->isAlarmed() when deciding to open new events in RECORDING_ONMOTION mode
  • Preserves existing behavior for all other recording modes and scenarios

Applies to both ONVIF and Amcrest external triggers under WITH_GSOAP compilation flag.

Original prompt

This section details on the original issue you should resolve

<issue_title>Recordings do not extend past end of current event.</issue_title>
<issue_description>Describe Your Environment

  • Version of ZoneMinder [release version, development version, or commit] 1.37.77
  • How you installed ZoneMinder [e.g. PPA, RPMFusion, from-source, etc]
  • Full name and version of OS Debian 12 bookworm

If the issue concerns a camera

  • Make and Model
  • frame rate
  • resolution
  • ZoneMinder Source Type:

Describe the bug
Recordings triggered by ONVIF do not continue in next section if not cleared.

Expected behavior
Recordings will continue until a false is sent.

Debug Logs

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 2, 2026 17:29
When an ONVIF-triggered event reaches section_length and closes,
a new event should immediately open if the ONVIF alarm is still active.

Previously, new events only opened if state==ALARM, but ONVIF alarms
may be active without the state being ALARM yet. This caused recording
to stop even though the ONVIF trigger was still active.

Now checks onvif->isAlarmed() and Amcrest_Manager->isAlarmed() when
deciding to open a new event in RECORDING_ONMOTION mode.

Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
Combine ONVIF and Amcrest alarm checks with OR operator
for cleaner code and remove trailing whitespace.

Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix recordings not extending past end of current event Fix ONVIF recordings stopping at section_length boundary despite active trigger Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recordings do not extend past end of current event.

2 participants