Browse Source

remove 'disable' from names of configuration parameters (#2101)

pull/2169/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
61d300396d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      apidocs/openapi.yaml
  2. 8
      bench/proxy/start.sh
  3. 32
      internal/conf/conf.go
  4. 4
      internal/core/api_test.go
  5. 24
      internal/core/core.go
  6. 6
      internal/core/hls_source_test.go
  7. 12
      internal/core/path_manager_test.go
  8. 22
      internal/core/rtmp_server_test.go
  9. 38
      internal/core/rtsp_server_test.go
  10. 12
      internal/core/rtsp_source_test.go
  11. 18
      internal/highleveltests/rtsp_server_test.go
  12. 16
      mediamtx.yml

8
apidocs/openapi.yaml

@ -55,7 +55,7 @@ components:
type: boolean type: boolean
# RTSP # RTSP
rtspDisable: rtsp:
type: boolean type: boolean
protocols: protocols:
type: array type: array
@ -87,7 +87,7 @@ components:
type: string type: string
# RTMP # RTMP
rtmpDisable: rtmp:
type: boolean type: boolean
rtmpAddress: rtmpAddress:
type: string type: string
@ -101,7 +101,7 @@ components:
type: string type: string
# HLS # HLS
hlsDisable: hls:
type: boolean type: boolean
hlsAddress: hlsAddress:
type: string type: string
@ -133,7 +133,7 @@ components:
type: string type: string
# WebRTC # WebRTC
webrtcDisable: webrtc:
type: boolean type: boolean
webrtcAddress: webrtcAddress:
type: string type: string

8
bench/proxy/start.sh

@ -7,7 +7,7 @@ PROXY_PROTOCOL=tcp
# source # source
CONF="" CONF=""
CONF="${CONF}hlsDisable: yes\n" CONF="${CONF}hls: no\n"
CONF="${CONF}rtspAddress: :8555\n" CONF="${CONF}rtspAddress: :8555\n"
CONF="${CONF}rtpAddress: :8002\n" CONF="${CONF}rtpAddress: :8002\n"
CONF="${CONF}rtcpAddress: :8003\n" CONF="${CONF}rtcpAddress: :8003\n"
@ -15,7 +15,7 @@ CONF="${CONF}paths:\n"
CONF="${CONF} all:\n" CONF="${CONF} all:\n"
echo -e "$CONF" > /source.conf echo -e "$CONF" > /source.conf
RTSP_RTMPDISABLE=yes /mediamtx /source.conf & RTSP_RTMP=no /mediamtx /source.conf &
sleep 1 sleep 1
@ -28,7 +28,7 @@ sleep 1
# proxy # proxy
CONF="" CONF=""
CONF="${CONF}hlsDisable: yes\n" CONF="${CONF}hls: no\n"
CONF="${CONF}pprof: yes\n" CONF="${CONF}pprof: yes\n"
CONF="${CONF}paths:\n" CONF="${CONF}paths:\n"
for i in $(seq 1 $PROXY_COUNT); do for i in $(seq 1 $PROXY_COUNT); do
@ -38,7 +38,7 @@ for i in $(seq 1 $PROXY_COUNT); do
done done
echo -e "$CONF" > /proxy.conf echo -e "$CONF" > /proxy.conf
RTSP_RTMPDISABLE=yes /mediamtx /proxy.conf & RTSP_RTMP=no /mediamtx /proxy.conf &
sleep 5 sleep 5

32
internal/conf/conf.go

@ -107,7 +107,8 @@ type Conf struct {
RunOnConnectRestart bool `json:"runOnConnectRestart"` RunOnConnectRestart bool `json:"runOnConnectRestart"`
// RTSP // RTSP
RTSPDisable bool `json:"rtspDisable"` RTSP bool `json:"rtsp"`
RTSPDisable bool `json:"rtspDisable"` // deprecated
Protocols Protocols `json:"protocols"` Protocols Protocols `json:"protocols"`
Encryption Encryption `json:"encryption"` Encryption Encryption `json:"encryption"`
RTSPAddress string `json:"rtspAddress"` RTSPAddress string `json:"rtspAddress"`
@ -122,7 +123,8 @@ type Conf struct {
AuthMethods AuthMethods `json:"authMethods"` AuthMethods AuthMethods `json:"authMethods"`
// RTMP // RTMP
RTMPDisable bool `json:"rtmpDisable"` RTMP bool `json:"rtmp"`
RTMPDisable bool `json:"rtmpDisable"` // deprecated
RTMPAddress string `json:"rtmpAddress"` RTMPAddress string `json:"rtmpAddress"`
RTMPEncryption Encryption `json:"rtmpEncryption"` RTMPEncryption Encryption `json:"rtmpEncryption"`
RTMPSAddress string `json:"rtmpsAddress"` RTMPSAddress string `json:"rtmpsAddress"`
@ -130,7 +132,8 @@ type Conf struct {
RTMPServerCert string `json:"rtmpServerCert"` RTMPServerCert string `json:"rtmpServerCert"`
// HLS // HLS
HLSDisable bool `json:"hlsDisable"` HLS bool `json:"hls"`
HLSDisable bool `json:"hlsDisable"` // depreacted
HLSAddress string `json:"hlsAddress"` HLSAddress string `json:"hlsAddress"`
HLSEncryption bool `json:"hlsEncryption"` HLSEncryption bool `json:"hlsEncryption"`
HLSServerKey string `json:"hlsServerKey"` HLSServerKey string `json:"hlsServerKey"`
@ -146,7 +149,8 @@ type Conf struct {
HLSDirectory string `json:"hlsDirectory"` HLSDirectory string `json:"hlsDirectory"`
// WebRTC // WebRTC
WebRTCDisable bool `json:"webrtcDisable"` WebRTC bool `json:"webrtc"`
WebRTCDisable bool `json:"webrtcDisable"` // deprecated
WebRTCAddress string `json:"webrtcAddress"` WebRTCAddress string `json:"webrtcAddress"`
WebRTCEncryption bool `json:"webrtcEncryption"` WebRTCEncryption bool `json:"webrtcEncryption"`
WebRTCServerKey string `json:"webrtcServerKey"` WebRTCServerKey string `json:"webrtcServerKey"`
@ -231,6 +235,9 @@ func (conf *Conf) Check() error {
} }
// RTSP // RTSP
if conf.RTSPDisable {
conf.RTSP = false
}
if conf.Encryption == EncryptionStrict { if conf.Encryption == EncryptionStrict {
if _, ok := conf.Protocols[Protocol(gortsplib.TransportUDP)]; ok { if _, ok := conf.Protocols[Protocol(gortsplib.TransportUDP)]; ok {
return fmt.Errorf("strict encryption can't be used with the UDP transport protocol") return fmt.Errorf("strict encryption can't be used with the UDP transport protocol")
@ -240,7 +247,20 @@ func (conf *Conf) Check() error {
} }
} }
// RTMP
if conf.RTMPDisable {
conf.RTMP = false
}
// HLS
if conf.HLSDisable {
conf.HLS = false
}
// WebRTC // WebRTC
if conf.WebRTCDisable {
conf.WebRTC = false
}
for _, server := range conf.WebRTCICEServers { for _, server := range conf.WebRTCICEServers {
parts := strings.Split(server, ":") parts := strings.Split(server, ":")
if len(parts) == 5 { if len(parts) == 5 {
@ -302,6 +322,7 @@ func (conf *Conf) UnmarshalJSON(b []byte) error {
conf.PPROFAddress = "127.0.0.1:9999" conf.PPROFAddress = "127.0.0.1:9999"
// RTSP // RTSP
conf.RTSP = true
conf.Protocols = Protocols{ conf.Protocols = Protocols{
Protocol(gortsplib.TransportUDP): {}, Protocol(gortsplib.TransportUDP): {},
Protocol(gortsplib.TransportUDPMulticast): {}, Protocol(gortsplib.TransportUDPMulticast): {},
@ -319,10 +340,12 @@ func (conf *Conf) UnmarshalJSON(b []byte) error {
conf.AuthMethods = AuthMethods{headers.AuthBasic} conf.AuthMethods = AuthMethods{headers.AuthBasic}
// RTMP // RTMP
conf.RTMP = true
conf.RTMPAddress = ":1935" conf.RTMPAddress = ":1935"
conf.RTMPSAddress = ":1936" conf.RTMPSAddress = ":1936"
// HLS // HLS
conf.HLS = true
conf.HLSAddress = ":8888" conf.HLSAddress = ":8888"
conf.HLSServerKey = "server.key" conf.HLSServerKey = "server.key"
conf.HLSServerCert = "server.crt" conf.HLSServerCert = "server.crt"
@ -334,6 +357,7 @@ func (conf *Conf) UnmarshalJSON(b []byte) error {
conf.HLSAllowOrigin = "*" conf.HLSAllowOrigin = "*"
// WebRTC // WebRTC
conf.WebRTC = true
conf.WebRTCAddress = ":8889" conf.WebRTCAddress = ":8889"
conf.WebRTCServerKey = "server.key" conf.WebRTCServerKey = "server.key"
conf.WebRTCServerCert = "server.crt" conf.WebRTCServerCert = "server.crt"

4
internal/core/api_test.go

@ -126,7 +126,7 @@ func TestAPIConfigSet(t *testing.T) {
hc := &http.Client{Transport: &http.Transport{}} hc := &http.Client{Transport: &http.Transport{}}
httpRequest(t, hc, http.MethodPost, "http://localhost:9997/v2/config/set", map[string]interface{}{ httpRequest(t, hc, http.MethodPost, "http://localhost:9997/v2/config/set", map[string]interface{}{
"rtmpDisable": true, "rtmp": false,
"readTimeout": "7s", "readTimeout": "7s",
"protocols": []string{"tcp"}, "protocols": []string{"tcp"},
}, nil) }, nil)
@ -135,7 +135,7 @@ func TestAPIConfigSet(t *testing.T) {
var out map[string]interface{} var out map[string]interface{}
httpRequest(t, hc, http.MethodGet, "http://localhost:9997/v2/config/get", nil, &out) httpRequest(t, hc, http.MethodGet, "http://localhost:9997/v2/config/get", nil, &out)
require.Equal(t, true, out["rtmpDisable"]) require.Equal(t, false, out["rtmp"])
require.Equal(t, "7s", out["readTimeout"]) require.Equal(t, "7s", out["readTimeout"])
require.Equal(t, []interface{}{"tcp"}, out["protocols"]) require.Equal(t, []interface{}{"tcp"}, out["protocols"])
} }

24
internal/core/core.go

@ -255,7 +255,7 @@ func (p *Core) createResources(initial bool) error {
) )
} }
if !p.conf.RTSPDisable && if p.conf.RTSP &&
(p.conf.Encryption == conf.EncryptionNo || (p.conf.Encryption == conf.EncryptionNo ||
p.conf.Encryption == conf.EncryptionOptional) { p.conf.Encryption == conf.EncryptionOptional) {
if p.rtspServer == nil { if p.rtspServer == nil {
@ -292,7 +292,7 @@ func (p *Core) createResources(initial bool) error {
} }
} }
if !p.conf.RTSPDisable && if p.conf.RTSP &&
(p.conf.Encryption == conf.EncryptionStrict || (p.conf.Encryption == conf.EncryptionStrict ||
p.conf.Encryption == conf.EncryptionOptional) { p.conf.Encryption == conf.EncryptionOptional) {
if p.rtspsServer == nil { if p.rtspsServer == nil {
@ -327,7 +327,7 @@ func (p *Core) createResources(initial bool) error {
} }
} }
if !p.conf.RTMPDisable && if p.conf.RTMP &&
(p.conf.RTMPEncryption == conf.EncryptionNo || (p.conf.RTMPEncryption == conf.EncryptionNo ||
p.conf.RTMPEncryption == conf.EncryptionOptional) { p.conf.RTMPEncryption == conf.EncryptionOptional) {
if p.rtmpServer == nil { if p.rtmpServer == nil {
@ -353,7 +353,7 @@ func (p *Core) createResources(initial bool) error {
} }
} }
if !p.conf.RTMPDisable && if p.conf.RTMP &&
(p.conf.RTMPEncryption == conf.EncryptionStrict || (p.conf.RTMPEncryption == conf.EncryptionStrict ||
p.conf.RTMPEncryption == conf.EncryptionOptional) { p.conf.RTMPEncryption == conf.EncryptionOptional) {
if p.rtmpsServer == nil { if p.rtmpsServer == nil {
@ -379,7 +379,7 @@ func (p *Core) createResources(initial bool) error {
} }
} }
if !p.conf.HLSDisable { if p.conf.HLS {
if p.hlsManager == nil { if p.hlsManager == nil {
p.hlsManager, err = newHLSManager( p.hlsManager, err = newHLSManager(
p.conf.HLSAddress, p.conf.HLSAddress,
@ -408,7 +408,7 @@ func (p *Core) createResources(initial bool) error {
} }
} }
if !p.conf.WebRTCDisable { if p.conf.WebRTC {
if p.webRTCManager == nil { if p.webRTCManager == nil {
p.webRTCManager, err = newWebRTCManager( p.webRTCManager, err = newWebRTCManager(
p.conf.WebRTCAddress, p.conf.WebRTCAddress,
@ -512,7 +512,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
} }
closeRTSPServer := newConf == nil || closeRTSPServer := newConf == nil ||
newConf.RTSPDisable != p.conf.RTSPDisable || newConf.RTSP != p.conf.RTSP ||
newConf.Encryption != p.conf.Encryption || newConf.Encryption != p.conf.Encryption ||
newConf.RTSPAddress != p.conf.RTSPAddress || newConf.RTSPAddress != p.conf.RTSPAddress ||
!reflect.DeepEqual(newConf.AuthMethods, p.conf.AuthMethods) || !reflect.DeepEqual(newConf.AuthMethods, p.conf.AuthMethods) ||
@ -533,7 +533,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
closePathManager closePathManager
closeRTSPSServer := newConf == nil || closeRTSPSServer := newConf == nil ||
newConf.RTSPDisable != p.conf.RTSPDisable || newConf.RTSP != p.conf.RTSP ||
newConf.Encryption != p.conf.Encryption || newConf.Encryption != p.conf.Encryption ||
newConf.RTSPSAddress != p.conf.RTSPSAddress || newConf.RTSPSAddress != p.conf.RTSPSAddress ||
!reflect.DeepEqual(newConf.AuthMethods, p.conf.AuthMethods) || !reflect.DeepEqual(newConf.AuthMethods, p.conf.AuthMethods) ||
@ -550,7 +550,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
closePathManager closePathManager
closeRTMPServer := newConf == nil || closeRTMPServer := newConf == nil ||
newConf.RTMPDisable != p.conf.RTMPDisable || newConf.RTMP != p.conf.RTMP ||
newConf.RTMPEncryption != p.conf.RTMPEncryption || newConf.RTMPEncryption != p.conf.RTMPEncryption ||
newConf.RTMPAddress != p.conf.RTMPAddress || newConf.RTMPAddress != p.conf.RTMPAddress ||
newConf.ReadTimeout != p.conf.ReadTimeout || newConf.ReadTimeout != p.conf.ReadTimeout ||
@ -563,7 +563,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
closePathManager closePathManager
closeRTMPSServer := newConf == nil || closeRTMPSServer := newConf == nil ||
newConf.RTMPDisable != p.conf.RTMPDisable || newConf.RTMP != p.conf.RTMP ||
newConf.RTMPEncryption != p.conf.RTMPEncryption || newConf.RTMPEncryption != p.conf.RTMPEncryption ||
newConf.RTMPSAddress != p.conf.RTMPSAddress || newConf.RTMPSAddress != p.conf.RTMPSAddress ||
newConf.ReadTimeout != p.conf.ReadTimeout || newConf.ReadTimeout != p.conf.ReadTimeout ||
@ -578,7 +578,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
closePathManager closePathManager
closeHLSManager := newConf == nil || closeHLSManager := newConf == nil ||
newConf.HLSDisable != p.conf.HLSDisable || newConf.HLS != p.conf.HLS ||
newConf.HLSAddress != p.conf.HLSAddress || newConf.HLSAddress != p.conf.HLSAddress ||
newConf.HLSEncryption != p.conf.HLSEncryption || newConf.HLSEncryption != p.conf.HLSEncryption ||
newConf.HLSServerKey != p.conf.HLSServerKey || newConf.HLSServerKey != p.conf.HLSServerKey ||
@ -599,7 +599,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
closeMetrics closeMetrics
closeWebRTCManager := newConf == nil || closeWebRTCManager := newConf == nil ||
newConf.WebRTCDisable != p.conf.WebRTCDisable || newConf.WebRTC != p.conf.WebRTC ||
newConf.WebRTCAddress != p.conf.WebRTCAddress || newConf.WebRTCAddress != p.conf.WebRTCAddress ||
newConf.WebRTCEncryption != p.conf.WebRTCEncryption || newConf.WebRTCEncryption != p.conf.WebRTCEncryption ||
newConf.WebRTCServerKey != p.conf.WebRTCServerKey || newConf.WebRTCServerKey != p.conf.WebRTCServerKey ||

6
internal/core/hls_source_test.go

@ -114,9 +114,9 @@ func TestHLSSource(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
defer ts.close() defer ts.close()
p, ok := newInstance("rtmpDisable: yes\n" + p, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" proxied:\n" + " proxied:\n" +
" source: http://localhost:5780/stream.m3u8\n" + " source: http://localhost:5780/stream.m3u8\n" +

12
internal/core/path_manager_test.go

@ -159,9 +159,9 @@ func main() {
t.Run(ca, func(t *testing.T) { t.Run(ca, func(t *testing.T) {
defer os.Remove(doneFile) defer os.Remove(doneFile)
p1, ok := newInstance(fmt.Sprintf("rtmpDisable: yes\n"+ p1, ok := newInstance(fmt.Sprintf("rtmp: no\n"+
"hlsDisable: yes\n"+ "hls: no\n"+
"webrtcDisable: yes\n"+ "webrtc: no\n"+
"paths:\n"+ "paths:\n"+
" '~^(on)demand$':\n"+ " '~^(on)demand$':\n"+
" runOnDemand: %s\n"+ " runOnDemand: %s\n"+
@ -248,9 +248,9 @@ func TestPathRunOnReady(t *testing.T) {
doneFile := filepath.Join(os.TempDir(), "onready_done") doneFile := filepath.Join(os.TempDir(), "onready_done")
defer os.Remove(doneFile) defer os.Remove(doneFile)
p, ok := newInstance(fmt.Sprintf("rtmpDisable: yes\n"+ p, ok := newInstance(fmt.Sprintf("rtmp: no\n"+
"hlsDisable: yes\n"+ "hls: no\n"+
"webrtcDisable: yes\n"+ "webrtc: no\n"+
"paths:\n"+ "paths:\n"+
" test:\n"+ " test:\n"+
" runOnReady: touch %s\n", " runOnReady: touch %s\n",

22
internal/core/rtmp_server_test.go

@ -62,8 +62,8 @@ func TestRTMPServer(t *testing.T) {
if encrypt == "plain" { if encrypt == "plain" {
port = "1935" port = "1935"
conf = "rtspDisable: yes\n" + conf = "rtsp: no\n" +
"hlsDisable: yes\n" "hls: no\n"
} else { } else {
port = "1936" port = "1936"
@ -75,9 +75,9 @@ func TestRTMPServer(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
defer os.Remove(serverKeyFpath) defer os.Remove(serverKeyFpath)
conf = "rtspDisable: yes\n" + conf = "rtsp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"rtmpEncryption: \"yes\"\n" + "rtmpEncryption: \"yes\"\n" +
"rtmpServerCert: " + serverCertFpath + "\n" + "rtmpServerCert: " + serverCertFpath + "\n" +
"rtmpServerKey: " + serverKeyFpath + "\n" "rtmpServerKey: " + serverKeyFpath + "\n"
@ -218,9 +218,9 @@ func TestRTMPServer(t *testing.T) {
func TestRTMPServerAuthFail(t *testing.T) { func TestRTMPServerAuthFail(t *testing.T) {
t.Run("publish", func(t *testing.T) { //nolint:dupl t.Run("publish", func(t *testing.T) { //nolint:dupl
p, ok := newInstance("rtspDisable: yes\n" + p, ok := newInstance("rtsp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" all:\n" + " all:\n" +
" publishUser: testuser2\n" + " publishUser: testuser2\n" +
@ -323,9 +323,9 @@ func TestRTMPServerAuthFail(t *testing.T) {
}) })
t.Run("read", func(t *testing.T) { //nolint:dupl t.Run("read", func(t *testing.T) { //nolint:dupl
p, ok := newInstance("rtspDisable: yes\n" + p, ok := newInstance("rtsp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" all:\n" + " all:\n" +
" readUser: testuser2\n" + " readUser: testuser2\n" +

38
internal/core/rtsp_server_test.go

@ -55,9 +55,9 @@ func TestRTSPServer(t *testing.T) {
" all:\n" " all:\n"
case "internal": case "internal":
conf = "rtmpDisable: yes\n" + conf = "rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" all:\n" + " all:\n" +
" publishUser: testpublisher\n" + " publishUser: testpublisher\n" +
@ -121,9 +121,9 @@ func TestRTSPServer(t *testing.T) {
func TestRTSPServerAuthHashed(t *testing.T) { func TestRTSPServerAuthHashed(t *testing.T) {
p, ok := newInstance( p, ok := newInstance(
"rtmpDisable: yes\n" + "rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" all:\n" + " all:\n" +
" publishUser: sha256:rl3rgi4NcZkpAEcacZnQ2VuOfJ0FxAqCRaKB/SwdZoQ=\n" + " publishUser: sha256:rl3rgi4NcZkpAEcacZnQ2VuOfJ0FxAqCRaKB/SwdZoQ=\n" +
@ -165,9 +165,9 @@ func TestRTSPServerAuthFail(t *testing.T) {
}, },
} { } {
t.Run("publish_"+ca.name, func(t *testing.T) { t.Run("publish_"+ca.name, func(t *testing.T) {
p, ok := newInstance("rtmpDisable: yes\n" + p, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" all:\n" + " all:\n" +
" publishUser: testuser\n" + " publishUser: testuser\n" +
@ -209,9 +209,9 @@ func TestRTSPServerAuthFail(t *testing.T) {
}, },
} { } {
t.Run("read_"+ca.name, func(t *testing.T) { t.Run("read_"+ca.name, func(t *testing.T) {
p, ok := newInstance("rtmpDisable: yes\n" + p, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" all:\n" + " all:\n" +
" readUser: testuser\n" + " readUser: testuser\n" +
@ -234,9 +234,9 @@ func TestRTSPServerAuthFail(t *testing.T) {
} }
t.Run("ip", func(t *testing.T) { t.Run("ip", func(t *testing.T) {
p, ok := newInstance("rtmpDisable: yes\n" + p, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" all:\n" + " all:\n" +
" publishIPs: [128.0.0.1/32]\n") " publishIPs: [128.0.0.1/32]\n")
@ -282,7 +282,7 @@ func TestRTSPServerPublisherOverride(t *testing.T) {
"disabled", "disabled",
} { } {
t.Run(ca, func(t *testing.T) { t.Run(ca, func(t *testing.T) {
conf := "rtmpDisable: yes\n" + conf := "rtmp: no\n" +
"paths:\n" + "paths:\n" +
" all:\n" " all:\n"
@ -390,9 +390,9 @@ func TestRTSPServerFallback(t *testing.T) {
return "/path2" return "/path2"
}() }()
p1, ok := newInstance("rtmpDisable: yes\n" + p1, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" path1:\n" + " path1:\n" +
" fallback: " + val + "\n" + " fallback: " + val + "\n" +

12
internal/core/rtsp_source_test.go

@ -215,9 +215,9 @@ func TestRTSPSourceNoPassword(t *testing.T) {
defer s.Wait() defer s.Wait()
defer s.Close() defer s.Close()
p, ok := newInstance("rtmpDisable: yes\n" + p, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" proxied:\n" + " proxied:\n" +
" source: rtsp://testuser:@127.0.0.1:8555/teststream\n" + " source: rtsp://testuser:@127.0.0.1:8555/teststream\n" +
@ -285,9 +285,9 @@ func TestRTSPSourceRange(t *testing.T) {
addConf += " rtspRangeType: smpte\n" + addConf += " rtspRangeType: smpte\n" +
" rtspRangeStart: 130s\n" " rtspRangeStart: 130s\n"
} }
p, ok := newInstance("rtmpDisable: yes\n" + p, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" proxied:\n" + " proxied:\n" +
" source: rtsp://testuser:@127.0.0.1:8555/teststream\n" + addConf) " source: rtsp://testuser:@127.0.0.1:8555/teststream\n" + addConf)

18
internal/highleveltests/rtsp_server_test.go

@ -42,9 +42,9 @@ func TestRTSPServerPublishRead(t *testing.T) {
proto = "rtsp" proto = "rtsp"
port = "8554" port = "8554"
p, ok := newInstance("rtmpDisable: yes\n" + p, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"readTimeout: 20s\n" + "readTimeout: 20s\n" +
"paths:\n" + "paths:\n" +
" all:\n") " all:\n")
@ -62,9 +62,9 @@ func TestRTSPServerPublishRead(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
defer os.Remove(serverKeyFpath) defer os.Remove(serverKeyFpath)
p, ok := newInstance("rtmpDisable: yes\n" + p, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"readTimeout: 20s\n" + "readTimeout: 20s\n" +
"protocols: [tcp]\n" + "protocols: [tcp]\n" +
"encryption: \"yes\"\n" + "encryption: \"yes\"\n" +
@ -199,9 +199,9 @@ func TestRTSPServerPublishRead(t *testing.T) {
} }
func TestRTSPServerRedirect(t *testing.T) { func TestRTSPServerRedirect(t *testing.T) {
p1, ok := newInstance("rtmpDisable: yes\n" + p1, ok := newInstance("rtmp: no\n" +
"hlsDisable: yes\n" + "hls: no\n" +
"webrtcDisable: yes\n" + "webrtc: no\n" +
"paths:\n" + "paths:\n" +
" path1:\n" + " path1:\n" +
" source: redirect\n" + " source: redirect\n" +

16
mediamtx.yml

@ -64,8 +64,8 @@ runOnConnectRestart: no
############################################### ###############################################
# RTSP parameters # RTSP parameters
# Disable support for the RTSP protocol. # Enable support for the RTSP protocol.
rtspDisable: no rtsp: yes
# List of enabled RTSP transport protocols. # List of enabled RTSP transport protocols.
# UDP is the most performant, but doesn't work when there's a NAT/firewall between # UDP is the most performant, but doesn't work when there's a NAT/firewall between
# server and clients, and doesn't support encryption. # server and clients, and doesn't support encryption.
@ -104,8 +104,8 @@ authMethods: [basic]
############################################### ###############################################
# RTMP parameters # RTMP parameters
# Disable support for the RTMP protocol. # Enable support for the RTMP protocol.
rtmpDisable: no rtmp: yes
# Address of the RTMP listener. This is needed only when encryption is "no" or "optional". # Address of the RTMP listener. This is needed only when encryption is "no" or "optional".
rtmpAddress: :1935 rtmpAddress: :1935
# Encrypt connections with TLS (RTMPS). # Encrypt connections with TLS (RTMPS).
@ -124,8 +124,8 @@ rtmpServerCert: server.crt
############################################### ###############################################
# HLS parameters # HLS parameters
# Disable support for the HLS protocol. # Enable support for the HLS protocol.
hlsDisable: no hls: yes
# Address of the HLS listener. # Address of the HLS listener.
hlsAddress: :8888 hlsAddress: :8888
# Enable TLS/HTTPS on the HLS server. # Enable TLS/HTTPS on the HLS server.
@ -180,8 +180,8 @@ hlsDirectory: ''
############################################### ###############################################
# WebRTC parameters # WebRTC parameters
# Disable support for the WebRTC protocol. # Enable support for the WebRTC protocol.
webrtcDisable: no webrtc: yes
# Address of the WebRTC listener. # Address of the WebRTC listener.
webrtcAddress: :8889 webrtcAddress: :8889
# Enable TLS/HTTPS on the WebRTC server. # Enable TLS/HTTPS on the WebRTC server.

Loading…
Cancel
Save