From 09242d72b33cd468021a5c1c19ba89dd783d12b0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 5 Oct 2017 16:05:41 -0400 Subject: [PATCH] implement alternate ports for streaming --- .../ZoneMinder/lib/ZoneMinder/ConfigData.pm.in | 15 +++++++++++++++ web/includes/Monitor.php | 7 +++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index 5ed90119c..ab6a743b3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -899,6 +899,21 @@ our @options = ( type => $types{integer}, category => 'network', }, + { + name => 'ZM_MIN_STREAMING_PORT', + default => '', + description => 'Alternate port range to contact for streaming video.', + help => q` + Due to browsers only wanting to open 6 connections, if you have more + than 6 monitors, you can have trouble viewing more than 6. This setting + specified the beginning of a port range that will be used to contact ZM + on. Each monitor will use this value plus the Monitor Id to stream + content. So a value of 2000 here will cause a stream for Monitor 1 to + hit port 2001. Please ensure that you configure apache appropriately + to respond on these ports.`, + type => $types{integer}, + category => 'network', + }, { name => 'ZM_MIN_RTP_PORT', default => '40200', diff --git a/web/includes/Monitor.php b/web/includes/Monitor.php index 41a978258..81465fc51 100644 --- a/web/includes/Monitor.php +++ b/web/includes/Monitor.php @@ -174,10 +174,13 @@ private $control_fields = array( public function getStreamSrc( $args, $querySep='&' ) { if ( isset($this->{'ServerId'}) and $this->{'ServerId'} ) { $Server = new Server( $this->{'ServerId'} ); - $streamSrc = ZM_BASE_PROTOCOL.'://'.$Server->Hostname().ZM_PATH_ZMS; + $streamSrc = ZM_BASE_PROTOCOL.'://'.$Server->Hostname(); } else { - $streamSrc = ZM_BASE_URL.ZM_PATH_ZMS; + $streamSrc = ZM_BASE_URL; } + if ( ZM_MIN_STREAMING_PORT ) + $streamSrc .= ':'. (ZM_MIN_STREAMING_PORT+$this->{'Id'}); + $streamSrc .= ZM_PATH_ZMS; $args['monitor'] = $this->{'Id'};