mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-23 00:22:19 +00:00
🐛 Copy SRT data in another buffer before sending it in the forwarding package to avoid overwriting issues
This commit is contained in:
parent
ee1f1e331b
commit
e74213fefa
@ -84,7 +84,10 @@ func Serve(cfg *Options, forwardingChannel chan Packet) {
|
|||||||
// log.Printf("Received %d bytes", n)
|
// log.Printf("Received %d bytes", n)
|
||||||
|
|
||||||
// Send raw packet to other streams
|
// Send raw packet to other streams
|
||||||
forwardingChannel <- Packet{StreamName: "demo", PacketType: "sendData", Data: buff[:n]}
|
// Copy data in another buffer to ensure that the data would not be overwritten
|
||||||
|
data := make([]byte, n)
|
||||||
|
copy(data, buff[:n])
|
||||||
|
forwardingChannel <- Packet{StreamName: "demo", PacketType: "sendData", Data: data}
|
||||||
|
|
||||||
// TODO: Send to WebRTC
|
// TODO: Send to WebRTC
|
||||||
// See https://github.com/ebml-go/webm/blob/master/reader.go
|
// See https://github.com/ebml-go/webm/blob/master/reader.go
|
||||||
|
Loading…
Reference in New Issue
Block a user