onvif: send explicit Stop after ContinuousMove; honor command.speed - #2124
Open
forevaclevah2 wants to merge 1 commit into
Open
forevaclevah2 wants to merge 1 commit into
forevaclevah2 wants to merge 1 commit into
Conversation
The ContinuousMove Timeout element is optional in the ONVIF spec and is not universally honored; some cameras move indefinitely. Send an explicit Stop after the movement duration instead of relying on the camera to self terminate. Stop is idempotent, so this is safe on cameras that do honor it. Also pass the speed-scaled x/y/zoom to continuousMove(), which were computed and then discarded in favor of the unscaled command values. Adds a ptzContinuousMoveDuration setting to tune the movement duration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ONVIF PTZ: Continuous movement never sends Stop, and
command.speedis discardedTwo issues in
plugins/onvif/src/onvif-ptz.ts,OnvifPtzMixin.ptzCommand.1.
command.speedis computed then droppedIn the Continuous branch,
x,yandzoomare scaled bycommand.speed:…and then
continuousMove()is called with the unscaledcommand.pan/command.tilt/command.zoom. The scaled values are dead stores, socommand.speedhas no effect inContinuous mode.
2. Continuous relies solely on the ONVIF
<Timeout>elementThe branch passes
timeout: command.timeout || 1000and never issuesStop, delegatingtermination entirely to the camera.
Timeoutis optional in the ONVIF PTZ spec and is notuniversally honored.
On an ONVIF_ICAMERA / JM800S5_AF (hw
MC800S5, fwV3.4.0.3), the camera ignores both theexplicit
<Timeout>PT1S</Timeout>and its own advertised<DefaultPTZTimeout>PT00H01M00S</DefaultPTZTimeout>. Measured against the live camera: asingle
ContinuousMoveproduced 84+ seconds of uninterrupted motion, sampled every 9s,halted only by an explicit
Stop. In practice one arrow tap in the UI pans the cameraindefinitely.
This camera has no working alternative mode, so
Continuousis not merely a preference here:RelativeMoveandAbsoluteMoveboth crash the camera's HTTP/ONVIF server outright(empty reply, connections refused ~5s, self-restart), so
ptzMovementType: 'Default'(which falls through to
relativeMove) is unusable.GetStatusis a stub returningx=-1 y=-1 zoom=-1, so there is no position feedback.ContinuousMove+StopandGotoPresetare the only operations that behave.Changes
x/y/zoomtocontinuousMove().continuousMove(), wait the movement duration and send an explicitStopratherthan depending on the camera to self-terminate.
Stopis idempotent, so this is harmlesson cameras that do honor
Timeout.ptzContinuousMoveDurationsetting (default 1000ms), since the useful nudge size iscamera-dependent — the NVR UI's tilt steps (±0.03125) are imperceptible at some velocities.
Note on the await
ptzCommandnow awaits theStop, so the promise resolves only once motion has actuallyceased. That felt more correct than fire-and-forget, but it does mean the call takes the
movement duration to resolve. Happy to switch to scheduling the stop without awaiting if
you'd prefer the snappier behavior.
Verified against the affected camera: movement occurs, then the camera parks and stays
parked; rapid repeated commands do not strand motion.