@@ -416,6 +416,13 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
rtspRangeStart:
|
rtspRangeStart:
|
||||||
type: string
|
type: string
|
||||||
|
rtspUDPSourcePortRange:
|
||||||
|
type: array
|
||||||
|
minItems: 2
|
||||||
|
maxItems: 2
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: uint64
|
||||||
|
|
||||||
# RTP source
|
# RTP source
|
||||||
rtpSDP:
|
rtpSDP:
|
||||||
|
|||||||
@@ -154,6 +154,8 @@ paths:
|
|||||||
# This can be increased to mitigate packet losses.
|
# This can be increased to mitigate packet losses.
|
||||||
# It defaults to the default value of the operating system.
|
# It defaults to the default value of the operating system.
|
||||||
rtspUDPReadBufferSize: 0
|
rtspUDPReadBufferSize: 0
|
||||||
|
# Range of ports used as source port in outgoing UDP packets.
|
||||||
|
rtspUDPSourcePortRange: [10000, 65535]
|
||||||
```
|
```
|
||||||
|
|
||||||
All available parameters are listed in the [configuration file](/docs/references/configuration-file).
|
All available parameters are listed in the [configuration file](/docs/references/configuration-file).
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ func TestConfFromFile(t *testing.T) {
|
|||||||
Source: "publisher",
|
Source: "publisher",
|
||||||
SourceOnDemandStartTimeout: 10 * Duration(time.Second),
|
SourceOnDemandStartTimeout: 10 * Duration(time.Second),
|
||||||
SourceOnDemandCloseAfter: 10 * Duration(time.Second),
|
SourceOnDemandCloseAfter: 10 * Duration(time.Second),
|
||||||
|
OverridePublisher: true,
|
||||||
AlwaysAvailableTracks: []AlwaysAvailableTrack{
|
AlwaysAvailableTracks: []AlwaysAvailableTrack{
|
||||||
{Codec: "H264"},
|
{Codec: "H264"},
|
||||||
},
|
},
|
||||||
@@ -61,7 +62,7 @@ func TestConfFromFile(t *testing.T) {
|
|||||||
RecordMaxPartSize: 50 * 1024 * 1024,
|
RecordMaxPartSize: 50 * 1024 * 1024,
|
||||||
RecordSegmentDuration: 3600000000000,
|
RecordSegmentDuration: 3600000000000,
|
||||||
RecordDeleteAfter: 86400000000000,
|
RecordDeleteAfter: 86400000000000,
|
||||||
OverridePublisher: true,
|
RTSPUDPSourcePortRange: []uint{10000, 65535},
|
||||||
RPICameraWidth: 1920,
|
RPICameraWidth: 1920,
|
||||||
RPICameraHeight: 1080,
|
RPICameraHeight: 1080,
|
||||||
RPICameraContrast: 1,
|
RPICameraContrast: 1,
|
||||||
|
|||||||
Vendored
+25
@@ -188,6 +188,31 @@ func loadEnvInternal(env map[string]string, prefix string, prv reflect.Value) er
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
|
case rt.Elem() == reflect.TypeOf(uint(0)):
|
||||||
|
if ev, ok := env[prefix]; ok {
|
||||||
|
if ev == "" {
|
||||||
|
prv.Elem().Set(reflect.MakeSlice(prv.Elem().Type(), 0, 0))
|
||||||
|
} else {
|
||||||
|
if prv.IsNil() {
|
||||||
|
prv.Set(reflect.New(rt))
|
||||||
|
}
|
||||||
|
|
||||||
|
raw := strings.Split(ev, ",")
|
||||||
|
vals := make([]uint, len(raw))
|
||||||
|
|
||||||
|
for i, v := range raw {
|
||||||
|
tmp, err := strconv.ParseUint(v, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
vals[i] = uint(tmp)
|
||||||
|
}
|
||||||
|
|
||||||
|
prv.Elem().Set(reflect.ValueOf(vals))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
case rt.Elem() == reflect.TypeOf(float64(0)):
|
case rt.Elem() == reflect.TypeOf(float64(0)):
|
||||||
if ev, ok := env[prefix]; ok {
|
if ev, ok := env[prefix]; ok {
|
||||||
if ev == "" {
|
if ev == "" {
|
||||||
|
|||||||
+11
-7
@@ -180,13 +180,14 @@ type Path struct {
|
|||||||
SRTPublishPassphrase string `json:"srtPublishPassphrase"`
|
SRTPublishPassphrase string `json:"srtPublishPassphrase"`
|
||||||
|
|
||||||
// RTSP source
|
// RTSP source
|
||||||
RTSPTransport RTSPTransport `json:"rtspTransport"`
|
RTSPTransport RTSPTransport `json:"rtspTransport"`
|
||||||
RTSPAnyPort bool `json:"rtspAnyPort"`
|
RTSPAnyPort bool `json:"rtspAnyPort"`
|
||||||
SourceProtocol *RTSPTransport `json:"sourceProtocol,omitempty"` // deprecated
|
SourceProtocol *RTSPTransport `json:"sourceProtocol,omitempty"` // deprecated
|
||||||
SourceAnyPortEnable *bool `json:"sourceAnyPortEnable,omitempty"` // deprecated
|
SourceAnyPortEnable *bool `json:"sourceAnyPortEnable,omitempty"` // deprecated
|
||||||
RTSPRangeType RTSPRangeType `json:"rtspRangeType"`
|
RTSPRangeType RTSPRangeType `json:"rtspRangeType"`
|
||||||
RTSPRangeStart string `json:"rtspRangeStart"`
|
RTSPRangeStart string `json:"rtspRangeStart"`
|
||||||
RTSPUDPReadBufferSize *uint `json:"rtspUDPReadBufferSize,omitempty"` // deprecated
|
RTSPUDPReadBufferSize *uint `json:"rtspUDPReadBufferSize,omitempty"` // deprecated
|
||||||
|
RTSPUDPSourcePortRange []uint `json:"rtspUDPSourcePortRange"`
|
||||||
|
|
||||||
// MPEG-TS source
|
// MPEG-TS source
|
||||||
MPEGTSUDPReadBufferSize *uint `json:"mpegtsUDPReadBufferSize,omitempty"` // deprecated
|
MPEGTSUDPReadBufferSize *uint `json:"mpegtsUDPReadBufferSize,omitempty"` // deprecated
|
||||||
@@ -287,6 +288,9 @@ func (pconf *Path) setDefaults() {
|
|||||||
// Publisher source
|
// Publisher source
|
||||||
pconf.OverridePublisher = true
|
pconf.OverridePublisher = true
|
||||||
|
|
||||||
|
// RTSP source
|
||||||
|
pconf.RTSPUDPSourcePortRange = []uint{10000, 65535}
|
||||||
|
|
||||||
// Raspberry Pi Camera source
|
// Raspberry Pi Camera source
|
||||||
pconf.RPICameraWidth = 1920
|
pconf.RPICameraWidth = 1920
|
||||||
pconf.RPICameraHeight = 1080
|
pconf.RPICameraHeight = 1080
|
||||||
|
|||||||
@@ -163,6 +163,10 @@ func (s *Source) Run(params defs.StaticSourceRunParams) error {
|
|||||||
WriteQueueSize: s.WriteQueueSize,
|
WriteQueueSize: s.WriteQueueSize,
|
||||||
UDPReadBufferSize: int(udpReadBufferSize),
|
UDPReadBufferSize: int(udpReadBufferSize),
|
||||||
AnyPortEnable: params.Conf.RTSPAnyPort,
|
AnyPortEnable: params.Conf.RTSPAnyPort,
|
||||||
|
UDPSourcePortRange: [2]uint16{
|
||||||
|
uint16(params.Conf.RTSPUDPSourcePortRange[0]),
|
||||||
|
uint16(params.Conf.RTSPUDPSourcePortRange[1]),
|
||||||
|
},
|
||||||
OnRequest: func(req *base.Request) {
|
OnRequest: func(req *base.Request) {
|
||||||
s.Log(logger.Debug, "[c->s] %v", req)
|
s.Log(logger.Debug, "[c->s] %v", req)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -141,20 +141,18 @@ func TestSource(t *testing.T) {
|
|||||||
defer strm.Close()
|
defer strm.Close()
|
||||||
|
|
||||||
var ur string
|
var ur string
|
||||||
var cnf *conf.Path
|
cnf := &conf.Path{
|
||||||
|
RTSPUDPSourcePortRange: []uint{10000, 65535},
|
||||||
|
}
|
||||||
|
|
||||||
if source != "tls" {
|
if source != "tls" {
|
||||||
ur = "rtsp://testuser:testpass@localhost:8555/teststream"
|
ur = "rtsp://testuser:testpass@localhost:8555/teststream"
|
||||||
var sp conf.RTSPTransport
|
var sp conf.RTSPTransport
|
||||||
sp.UnmarshalJSON([]byte(`"` + source + `"`)) //nolint:errcheck
|
sp.UnmarshalJSON([]byte(`"` + source + `"`)) //nolint:errcheck
|
||||||
cnf = &conf.Path{
|
cnf.RTSPTransport = sp
|
||||||
RTSPTransport: sp,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ur = "rtsps://testuser:testpass@localhost:8555/teststream"
|
ur = "rtsps://testuser:testpass@localhost:8555/teststream"
|
||||||
cnf = &conf.Path{
|
cnf.SourceFingerprint = "33949E05FFFB5FF3E8AA16F8213A6251B4D9363804BA53233C4DA9A46D6F2739"
|
||||||
SourceFingerprint: "33949E05FFFB5FF3E8AA16F8213A6251B4D9363804BA53233C4DA9A46D6F2739",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p := &test.StaticSourceParent{}
|
p := &test.StaticSourceParent{}
|
||||||
@@ -286,7 +284,8 @@ func TestNoPassword(t *testing.T) {
|
|||||||
Context: ctx,
|
Context: ctx,
|
||||||
ResolvedSource: "rtsp://testuser:@127.0.0.1:8555/teststream",
|
ResolvedSource: "rtsp://testuser:@127.0.0.1:8555/teststream",
|
||||||
Conf: &conf.Path{
|
Conf: &conf.Path{
|
||||||
RTSPTransport: sp,
|
RTSPTransport: sp,
|
||||||
|
RTSPUDPSourcePortRange: []uint{10000, 65535},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
close(done)
|
close(done)
|
||||||
@@ -362,7 +361,9 @@ func TestRange(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer strm.Close()
|
defer strm.Close()
|
||||||
|
|
||||||
cnf := &conf.Path{}
|
cnf := &conf.Path{
|
||||||
|
RTSPUDPSourcePortRange: []uint{10000, 65535},
|
||||||
|
}
|
||||||
|
|
||||||
switch ca {
|
switch ca {
|
||||||
case "clock":
|
case "clock":
|
||||||
@@ -496,7 +497,8 @@ func TestSkipBackChannel(t *testing.T) {
|
|||||||
Context: ctx,
|
Context: ctx,
|
||||||
ResolvedSource: "rtsp://127.0.0.1:8555/teststream",
|
ResolvedSource: "rtsp://127.0.0.1:8555/teststream",
|
||||||
Conf: &conf.Path{
|
Conf: &conf.Path{
|
||||||
RTSPTransport: conf.RTSPTransport{Protocol: ptrOf(gortsplib.ProtocolTCP)},
|
RTSPTransport: conf.RTSPTransport{Protocol: ptrOf(gortsplib.ProtocolTCP)},
|
||||||
|
RTSPUDPSourcePortRange: []uint{10000, 65535},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
close(done)
|
close(done)
|
||||||
@@ -571,7 +573,8 @@ func TestOnlyBackChannelsError(t *testing.T) {
|
|||||||
Context: ctx,
|
Context: ctx,
|
||||||
ResolvedSource: "rtsp://127.0.0.1:8555/teststream",
|
ResolvedSource: "rtsp://127.0.0.1:8555/teststream",
|
||||||
Conf: &conf.Path{
|
Conf: &conf.Path{
|
||||||
RTSPTransport: conf.RTSPTransport{Protocol: ptrOf(gortsplib.ProtocolTCP)},
|
RTSPTransport: conf.RTSPTransport{Protocol: ptrOf(gortsplib.ProtocolTCP)},
|
||||||
|
RTSPUDPSourcePortRange: []uint{10000, 65535},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -553,6 +553,8 @@ pathDefaults:
|
|||||||
# * npt: duration such as "300ms", "1.5m" or "2h45m", valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
|
# * npt: duration such as "300ms", "1.5m" or "2h45m", valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
|
||||||
# * smpte: duration such as "300ms", "1.5m" or "2h45m", valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
|
# * smpte: duration such as "300ms", "1.5m" or "2h45m", valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
|
||||||
rtspRangeStart:
|
rtspRangeStart:
|
||||||
|
# Range of ports used as source port in outgoing UDP packets.
|
||||||
|
rtspUDPSourcePortRange: [10000, 65535]
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
# Default path settings -> RTP source (when source is RTP)
|
# Default path settings -> RTP source (when source is RTP)
|
||||||
|
|||||||
Reference in New Issue
Block a user