mirror of
https://github.com/owncast/owncast.git
synced 2024-11-25 06:12:23 +03:00
Add custom RTMP port number support (#462)
* Bump api spec version * Add support for custom RTMP port. Closes #454
This commit is contained in:
parent
ef792c66a6
commit
e9c7ff29cf
4 changed files with 14 additions and 3 deletions
|
@ -26,6 +26,7 @@ type config struct {
|
||||||
VersionNumber string `yaml:"-"`
|
VersionNumber string `yaml:"-"`
|
||||||
VideoSettings videoSettings `yaml:"videoSettings"`
|
VideoSettings videoSettings `yaml:"videoSettings"`
|
||||||
WebServerPort int `yaml:"webServerPort"`
|
WebServerPort int `yaml:"webServerPort"`
|
||||||
|
RTMPServerPort int `yaml:"rtmpServerPort"`
|
||||||
DisableUpgradeChecks bool `yaml:"disableUpgradeChecks"`
|
DisableUpgradeChecks bool `yaml:"disableUpgradeChecks"`
|
||||||
YP YP `yaml:"yp"`
|
YP YP `yaml:"yp"`
|
||||||
}
|
}
|
||||||
|
@ -174,6 +175,14 @@ func (c *config) GetPublicWebServerPort() int {
|
||||||
return _default.WebServerPort
|
return _default.WebServerPort
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *config) GetRTMPServerPort() int {
|
||||||
|
if c.RTMPServerPort != 0 {
|
||||||
|
return c.RTMPServerPort
|
||||||
|
}
|
||||||
|
|
||||||
|
return _default.RTMPServerPort
|
||||||
|
}
|
||||||
|
|
||||||
func (c *config) GetMaxNumberOfReferencedSegmentsInPlaylist() int {
|
func (c *config) GetMaxNumberOfReferencedSegmentsInPlaylist() int {
|
||||||
if c.Files.MaxNumberInPlaylist > 0 {
|
if c.Files.MaxNumberInPlaylist > 0 {
|
||||||
return c.Files.MaxNumberInPlaylist
|
return c.Files.MaxNumberInPlaylist
|
||||||
|
|
|
@ -3,6 +3,7 @@ package config
|
||||||
func getDefaults() config {
|
func getDefaults() config {
|
||||||
defaults := config{}
|
defaults := config{}
|
||||||
defaults.WebServerPort = 8080
|
defaults.WebServerPort = 8080
|
||||||
|
defaults.RTMPServerPort = 1935
|
||||||
defaults.VideoSettings.ChunkLengthInSeconds = 4
|
defaults.VideoSettings.ChunkLengthInSeconds = 4
|
||||||
defaults.Files.MaxNumberInPlaylist = 5
|
defaults.Files.MaxNumberInPlaylist = 5
|
||||||
defaults.YP.Enabled = false
|
defaults.YP.Enabled = false
|
||||||
|
|
|
@ -66,7 +66,8 @@ func Start() error {
|
||||||
go rtmp.Start(setStreamAsConnected, setBroadcaster)
|
go rtmp.Start(setStreamAsConnected, setBroadcaster)
|
||||||
|
|
||||||
port := config.Config.GetPublicWebServerPort()
|
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.")
|
log.Infoln("The web admin interface is available at /admin.")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -30,12 +30,12 @@ var _rtmpConnection net.Conn
|
||||||
var _setStreamAsConnected func()
|
var _setStreamAsConnected func()
|
||||||
var _setBroadcaster func(models.Broadcaster)
|
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)) {
|
func Start(setStreamAsConnected func(), setBroadcaster func(models.Broadcaster)) {
|
||||||
_setStreamAsConnected = setStreamAsConnected
|
_setStreamAsConnected = setStreamAsConnected
|
||||||
_setBroadcaster = setBroadcaster
|
_setBroadcaster = setBroadcaster
|
||||||
|
|
||||||
port := 1935
|
port := config.Config.GetRTMPServerPort()
|
||||||
s := rtmp.NewServer()
|
s := rtmp.NewServer()
|
||||||
var lis net.Listener
|
var lis net.Listener
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Reference in a new issue