mirror of
				https://gitlab.crans.org/nounous/ghostream.git
				synced 2025-11-04 00:32:04 +01:00 
			
		
		
		
	🐛 Copy SRT data in another buffer before sending it in the forwarding package to avoid overwriting issues
This commit is contained in:
		@@ -84,7 +84,10 @@ func Serve(cfg *Options, forwardingChannel chan Packet) {
 | 
			
		||||
			// log.Printf("Received %d bytes", n)
 | 
			
		||||
 | 
			
		||||
			// 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
 | 
			
		||||
			// See https://github.com/ebml-go/webm/blob/master/reader.go
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user