1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-22 13:52:19 +00:00

Limit SRT buffer to MTU

This commit is contained in:
Alexandre Iooss 2020-10-04 14:27:16 +02:00
parent dd6318256f
commit 86d436d33d
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02

View File

@ -10,15 +10,16 @@ func handleStreamer(s *srtgo.SrtSocket, name string, clientDataChannels *[]chan
log.Printf("New SRT streamer for stream %s", name)
// Create a new buffer
buff := make([]byte, 2048)
// UDP packet cannot be larger than MTU (1500)
buff := make([]byte, 1500)
// Setup stream forwarding
forwardingChannel <- Packet{StreamName: name, PacketType: "register", Data: nil}
// Read RTP packets forever and send them to the WebRTC Client
for {
// UDP packet cannot be larger than MTU (1500)
n, err := s.Read(buff, 1500)
// 5s timeout
n, err := s.Read(buff, 5000)
if err != nil {
log.Println("Error occured while reading SRT socket:", err)
break