@@ -223,6 +223,7 @@ int Monitor::Go2RTCManager::add_to_Go2RTC() {
223223 const std::string &primary_path = Use_RTSP_Restream ? rtsp_restream_path : rtsp_path;
224224 const std::string id_str = std::to_string (parent->Id ());
225225 const std::string monitor_name = parent->Name ();
226+ const bool has_monitor_name = !monitor_name.empty () && monitor_name != id_str;
226227
227228 const auto add_stream = [&](const std::string &stream_name,
228229 const std::string &display_name,
@@ -248,14 +249,14 @@ int Monitor::Go2RTCManager::add_to_Go2RTC() {
248249 curl_easy_cleanup (curl);
249250 return -1 ;
250251 }
251- if (monitor_name != id_str ) {
252+ if (has_monitor_name ) {
252253 add_stream (monitor_name, monitor_name, primary_path, " primary (monitor name)" );
253254 }
254255
255256 // Add ZoneMinder restream paths (when RTSP restreamer is enabled)
256257 if (Use_RTSP_Restream) {
257258 if (add_stream (id_str + " _ZoneMinderPrimary" , monitor_name + " ZoneMinder Primary" ,
258- rtsp_restream_path, " ZoneMinderPrimary (monitor ID)" ) && monitor_name != id_str ) {
259+ rtsp_restream_path, " ZoneMinderPrimary (monitor ID)" ) && has_monitor_name ) {
259260 add_stream (monitor_name + " _ZoneMinderPrimary" , monitor_name + " ZoneMinder Primary" ,
260261 rtsp_restream_path, " ZoneMinderPrimary (monitor name)" );
261262 }
@@ -264,15 +265,15 @@ int Monitor::Go2RTCManager::add_to_Go2RTC() {
264265 // Add direct camera paths
265266 if (!rtsp_path.empty ()) {
266267 if (add_stream (id_str + " _CameraDirectPrimary" , monitor_name + " Camera Direct Primary" ,
267- rtsp_path, " CameraDirectPrimary (monitor ID)" ) && monitor_name != id_str ) {
268+ rtsp_path, " CameraDirectPrimary (monitor ID)" ) && has_monitor_name ) {
268269 add_stream (monitor_name + " _CameraDirectPrimary" , monitor_name + " Camera Direct Primary" ,
269270 rtsp_path, " CameraDirectPrimary (monitor name)" );
270271 }
271272 }
272273
273274 if (!rtsp_second_path.empty ()) {
274275 if (add_stream (id_str + " _CameraDirectSecondary" , monitor_name + " Camera Direct Secondary" ,
275- rtsp_second_path, " CameraDirectSecondary (monitor ID)" ) && monitor_name != id_str ) {
276+ rtsp_second_path, " CameraDirectSecondary (monitor ID)" ) && has_monitor_name ) {
276277 add_stream (monitor_name + " _CameraDirectSecondary" , monitor_name + " Camera Direct Secondary" ,
277278 rtsp_second_path, " CameraDirectSecondary (monitor name)" );
278279 }
0 commit comments