1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-23 01:32:19 +00:00
This commit is contained in:
Yohann D'ANELLO 2020-10-03 16:15:42 +02:00
parent 8da60ebdcc
commit 98a798429c

View File

@ -58,7 +58,7 @@ func Serve(cfg *Options, backend auth.Backend, forwarding chan Packet) {
forwardingChannel = forwarding forwardingChannel = forwarding
options := make(map[string]string) options := make(map[string]string)
options["transtype"] = "live" options["transtype"] = "file"
options["mode"] = "listener" options["mode"] = "listener"
// Start SRT in listen mode // Start SRT in listen mode
@ -90,9 +90,9 @@ func Serve(cfg *Options, backend auth.Backend, forwarding chan Packet) {
go acceptCallerSocket(s, clientDataChannels, &listeners) go acceptCallerSocket(s, clientDataChannels, &listeners)
streamStarted = true streamStarted = true
} else { } else {
dataChannel := make(chan Packet) dataChannel := make(chan Packet, 2048)
clientDataChannels[listeners] = dataChannel clientDataChannels[listeners] = dataChannel
listeners += 1 listeners++
go acceptListeningSocket(s, dataChannel) go acceptListeningSocket(s, dataChannel)
} }
} }
@ -136,7 +136,7 @@ func acceptCallerSocket(s *srtgo.SrtSocket, clientDataChannels []chan Packet, li
data := make([]byte, n) data := make([]byte, n)
copy(data, buff[:n]) copy(data, buff[:n])
forwardingChannel <- Packet{StreamName: streamName, PacketType: "sendData", Data: data} forwardingChannel <- Packet{StreamName: streamName, PacketType: "sendData", Data: data}
for i := 0; i < *listeners; i += 1 { for i := 0; i < *listeners; i++ {
clientDataChannels[i] <- Packet{StreamName: streamName, PacketType: "sendData", Data: data} clientDataChannels[i] <- Packet{StreamName: streamName, PacketType: "sendData", Data: data}
} }