mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 19:42:20 +00:00
Limit SRT buffer to MTU
This commit is contained in:
parent
dd6318256f
commit
86d436d33d
@ -10,15 +10,16 @@ func handleStreamer(s *srtgo.SrtSocket, name string, clientDataChannels *[]chan
|
|||||||
log.Printf("New SRT streamer for stream %s", name)
|
log.Printf("New SRT streamer for stream %s", name)
|
||||||
|
|
||||||
// Create a new buffer
|
// Create a new buffer
|
||||||
buff := make([]byte, 2048)
|
// UDP packet cannot be larger than MTU (1500)
|
||||||
|
buff := make([]byte, 1500)
|
||||||
|
|
||||||
// Setup stream forwarding
|
// Setup stream forwarding
|
||||||
forwardingChannel <- Packet{StreamName: name, PacketType: "register", Data: nil}
|
forwardingChannel <- Packet{StreamName: name, PacketType: "register", Data: nil}
|
||||||
|
|
||||||
// Read RTP packets forever and send them to the WebRTC Client
|
// Read RTP packets forever and send them to the WebRTC Client
|
||||||
for {
|
for {
|
||||||
// UDP packet cannot be larger than MTU (1500)
|
// 5s timeout
|
||||||
n, err := s.Read(buff, 1500)
|
n, err := s.Read(buff, 5000)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error occured while reading SRT socket:", err)
|
log.Println("Error occured while reading SRT socket:", err)
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user