|
|
|
@ -23,7 +23,6 @@ type Parent interface { |
|
|
|
type ClientManager struct { |
|
|
|
type ClientManager struct { |
|
|
|
rtspPort int |
|
|
|
rtspPort int |
|
|
|
readTimeout time.Duration |
|
|
|
readTimeout time.Duration |
|
|
|
writeTimeout time.Duration |
|
|
|
|
|
|
|
runOnConnect string |
|
|
|
runOnConnect string |
|
|
|
runOnConnectRestart bool |
|
|
|
runOnConnectRestart bool |
|
|
|
protocols map[base.StreamProtocol]struct{} |
|
|
|
protocols map[base.StreamProtocol]struct{} |
|
|
|
@ -49,7 +48,6 @@ type ClientManager struct { |
|
|
|
func New( |
|
|
|
func New( |
|
|
|
rtspPort int, |
|
|
|
rtspPort int, |
|
|
|
readTimeout time.Duration, |
|
|
|
readTimeout time.Duration, |
|
|
|
writeTimeout time.Duration, |
|
|
|
|
|
|
|
runOnConnect string, |
|
|
|
runOnConnect string, |
|
|
|
runOnConnectRestart bool, |
|
|
|
runOnConnectRestart bool, |
|
|
|
protocols map[base.StreamProtocol]struct{}, |
|
|
|
protocols map[base.StreamProtocol]struct{}, |
|
|
|
@ -63,7 +61,6 @@ func New( |
|
|
|
cm := &ClientManager{ |
|
|
|
cm := &ClientManager{ |
|
|
|
rtspPort: rtspPort, |
|
|
|
rtspPort: rtspPort, |
|
|
|
readTimeout: readTimeout, |
|
|
|
readTimeout: readTimeout, |
|
|
|
writeTimeout: writeTimeout, |
|
|
|
|
|
|
|
runOnConnect: runOnConnect, |
|
|
|
runOnConnect: runOnConnect, |
|
|
|
runOnConnectRestart: runOnConnectRestart, |
|
|
|
runOnConnectRestart: runOnConnectRestart, |
|
|
|
protocols: protocols, |
|
|
|
protocols: protocols, |
|
|
|
@ -101,7 +98,7 @@ outer: |
|
|
|
for { |
|
|
|
for { |
|
|
|
select { |
|
|
|
select { |
|
|
|
case conn := <-cm.serverTCP.Accept(): |
|
|
|
case conn := <-cm.serverTCP.Accept(): |
|
|
|
c := client.New(cm.rtspPort, cm.readTimeout, cm.writeTimeout, |
|
|
|
c := client.New(cm.rtspPort, cm.readTimeout, |
|
|
|
cm.runOnConnect, cm.runOnConnectRestart, cm.protocols, &cm.wg, |
|
|
|
cm.runOnConnect, cm.runOnConnectRestart, cm.protocols, &cm.wg, |
|
|
|
cm.stats, cm.serverUDPRtp, cm.serverUDPRtcp, conn, cm) |
|
|
|
cm.stats, cm.serverUDPRtp, cm.serverUDPRtcp, conn, cm) |
|
|
|
cm.clients[c] = struct{}{} |
|
|
|
cm.clients[c] = struct{}{} |
|
|
|
|