mirror of
https://github.com/pion/webrtc.git
synced 2025-10-06 23:52:51 +08:00
Process RTCP Packets in OnTrack examples
TWCC and Receiver Reports are needed for a good default experience
This commit is contained in:
@@ -64,6 +64,18 @@ func main() { // nolint:gocognit
|
||||
}
|
||||
}()
|
||||
|
||||
// Read incoming RTCP packets
|
||||
// Before these packets are returned they are processed by interceptors. For things
|
||||
// like TWCC and RTCP Reports this needs to be called.
|
||||
go func() {
|
||||
rtcpBuf := make([]byte, 1500)
|
||||
for {
|
||||
if _, _, rtcpErr := receiver.Read(rtcpBuf); rtcpErr != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
// Create a local track, all our SFU clients will be fed via this track
|
||||
localTrack, newTrackErr := webrtc.NewTrackLocalStaticRTP(remoteTrack.Codec().RTPCodecCapability, "video", "pion")
|
||||
if newTrackErr != nil {
|
||||
|
Reference in New Issue
Block a user