Fix ONVIF NVR compatibility for RTSP streaming#2151
Open
Moonbesk wants to merge 1 commit intoAlexxIT:masterfrom
Open
Fix ONVIF NVR compatibility for RTSP streaming#2151Moonbesk wants to merge 1 commit intoAlexxIT:masterfrom
Moonbesk wants to merge 1 commit intoAlexxIT:masterfrom
Conversation
…forms 1. Fix duplicate SDP tracks on re-DESCRIBE within same RTSP connection 2. Declare RTP_TCP=true in ONVIF capabilities for NVR compatibility 3. Accept UDP SETUP requests and force TCP interleaved transport in response
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.
Summary
This PR fixes three issues that cause ONVIF clients (e.g. Hikvision ISC/iSecure Center) to fail when connecting to go2rtc's ONVIF server for RTSP streaming. The failure rate was approximately 80-90%.
Root Causes
ONVIF capabilities declare RTP_TCP as false — ONVIF clients check
GetCapabilitiesandGetServiceCapabilitiesbefore attempting RTSP SETUP. WhenRTP_TCP=false, clients like Hikvision ISC skip the SETUP entirely, resulting in silent stream failure.RTSP server rejects UDP transport requests — When an ONVIF client sends
SETUPwithRTP/AVP(UDP), the server returns461 Unsupported transport. Since go2rtc only supports TCP interleaved, the server should accept the request but respond with TCP interleaved transport parameters.SDP track accumulation on re-DESCRIBE — Some ONVIF clients reuse the same RTSP connection to send multiple DESCRIBE requests (e.g. when switching profiles). The
SendersandReceiversslices were never reset, causing duplicate tracks to accumulate and break playback.Changes
RTP_TCPtotruein bothGetCapabilitiesandGetServiceCapabilitiesresponsesRTP/AVP(UDP) SETUP requests and respond with TCP interleaved transportTesting
Tested with Hikvision ISC (iSecure Center) NVR platform connecting to go2rtc v1.9.14 ONVIF server. After the fix, streams connect reliably (previously ~80-90% failure rate).