fix: do not use the RTSP restream when ZM_MIN_RTSP_PORT is not set

ZoneMinder's RTSP server only starts when ZM_MIN_RTSP_PORT is set, and it
defaults to empty. The go2rtc and Janus managers decided to use the
restream from the monitor's RTSP Server flag (Janus: its restream flag)
alone, so with the port unset they built rtsp://127.0.0.1:0/<name>.
go2rtc was given that as the monitor's primary stream and as
<id>_ZoneMinderPrimary, neither of which can play; Janus pointed its
mountpoint at it.

Use the restream only when the port is set as well, and warn when a
monitor asks for it without one, so the camera's own stream is used.
MonitorStream applies the same test before choosing the
_ZoneMinderPrimary stream, which is no longer registered in that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Isaac ConnorandClaude Opus 5.5 committed 2026-10-05 18:34:04 -04:00
1 parent 0d6ebcd42c
commit c3ff83fa56
3 files changed
+17 -3

No files matched your search

+7 -1
View File
@@ -43,7 +43,13 @@ Monitor::Go2RTCManager::Go2RTCManager(Monitor *parent_)
Warning("Go2RTC: No endpoint configured in ZM_GO2RTC_PATH, using default: %s", Go2RTC_endpoint.c_str());
}
Use_RTSP_Restream = parent->RTSPServer();
// ZoneMinder's RTSP server only runs when ZM_MIN_RTSP_PORT is set, so without it
// there is no restream to point go2rtc at; use the camera's own stream instead.
Use_RTSP_Restream = parent->RTSPServer() && config.min_rtsp_port;
if (parent->RTSPServer() && !config.min_rtsp_port) {
Warning("Go2RTC: monitor %u has RTSP Server enabled but ZM_MIN_RTSP_PORT is not set, "
"so there is no restream; using the camera stream", parent->Id());
}
if (Use_RTSP_Restream) {
if (parent->server_id) {
Server server(parent->server_id);
+6 -1
View File
@@ -39,7 +39,12 @@ Monitor::JanusManager::~JanusManager() {
void Monitor::JanusManager::load_from_monitor() {
//constructor takes care of init and calls add_to
Use_RTSP_Restream = parent->restream;
// The restream needs ZoneMinder's RTSP server, which only runs when ZM_MIN_RTSP_PORT is set.
Use_RTSP_Restream = parent->restream && config.min_rtsp_port;
if (parent->restream && !config.min_rtsp_port) {
Warning("Janus: monitor %u is set to use the RTSP restream but ZM_MIN_RTSP_PORT is not set, "
"so there is no restream; using the camera stream", parent->Id());
}
profile_override = parent->janus_profile_override;
rtsp_session_timeout = parent->janus_rtsp_session_timeout;
if ((config.janus_path != nullptr) && (config.janus_path[0] != '\0')) {
+4 -1
View File
@@ -35,7 +35,10 @@ function MonitorStream(monitorData) {
this.RTSP2WebEnabled = monitorData.RTSP2WebEnabled;
this.RTSP2WebType = null;
this.StreamChannel = monitorData.StreamChannel;
this.RTSPServer = monitorData.RTSPServer;
// ZoneMinder's RTSP restream only exists when its RTSP server runs, which needs
// ZM_MIN_RTSP_PORT; without it zmc registers no ZoneMinderPrimary stream.
this.RTSPServer = monitorData.RTSPServer &&
(typeof ZM_MIN_RTSP_PORT !== 'undefined') && !!ZM_MIN_RTSP_PORT;
this.Go2RTCEnabled = monitorData.Go2RTCEnabled;
this.Go2RTCMSEBufferCleared = true;
this.currentChannelStream = null;