diff --git a/config/config.go b/config/config.go index 2f88b229e..a65d15799 100644 --- a/config/config.go +++ b/config/config.go @@ -26,6 +26,7 @@ type config struct { VersionNumber string `yaml:"-"` VideoSettings videoSettings `yaml:"videoSettings"` WebServerPort int `yaml:"webServerPort"` + RTMPServerPort int `yaml:"rtmpServerPort"` DisableUpgradeChecks bool `yaml:"disableUpgradeChecks"` YP YP `yaml:"yp"` } @@ -174,6 +175,14 @@ func (c *config) GetPublicWebServerPort() int { return _default.WebServerPort } +func (c *config) GetRTMPServerPort() int { + if c.RTMPServerPort != 0 { + return c.RTMPServerPort + } + + return _default.RTMPServerPort +} + func (c *config) GetMaxNumberOfReferencedSegmentsInPlaylist() int { if c.Files.MaxNumberInPlaylist > 0 { return c.Files.MaxNumberInPlaylist diff --git a/config/defaults.go b/config/defaults.go index 251800a56..1ff2c1a64 100644 --- a/config/defaults.go +++ b/config/defaults.go @@ -3,6 +3,7 @@ package config func getDefaults() config { defaults := config{} defaults.WebServerPort = 8080 + defaults.RTMPServerPort = 1935 defaults.VideoSettings.ChunkLengthInSeconds = 4 defaults.Files.MaxNumberInPlaylist = 5 defaults.YP.Enabled = false diff --git a/core/core.go b/core/core.go index 39636902d..1f911fcc4 100644 --- a/core/core.go +++ b/core/core.go @@ -66,7 +66,8 @@ func Start() error { go rtmp.Start(setStreamAsConnected, setBroadcaster) port := config.Config.GetPublicWebServerPort() - log.Infof("Web server is listening on port %d, RTMP is accepting inbound streams on port 1935.", port) + rtmpPort := config.Config.GetRTMPServerPort() + log.Infof("Web server is listening on port %d, RTMP is accepting inbound streams on port %d.", port, rtmpPort) log.Infoln("The web admin interface is available at /admin.") return nil diff --git a/core/rtmp/rtmp.go b/core/rtmp/rtmp.go index 648834def..a5eb68cb6 100644 --- a/core/rtmp/rtmp.go +++ b/core/rtmp/rtmp.go @@ -30,12 +30,12 @@ var _rtmpConnection net.Conn var _setStreamAsConnected func() var _setBroadcaster func(models.Broadcaster) -// Start starts the rtmp service, listening on port 1935. +// Start starts the rtmp service, listening on specified RTMP port. func Start(setStreamAsConnected func(), setBroadcaster func(models.Broadcaster)) { _setStreamAsConnected = setStreamAsConnected _setBroadcaster = setBroadcaster - port := 1935 + port := config.Config.GetRTMPServerPort() s := rtmp.NewServer() var lis net.Listener var err error