diff --git a/examples/broadcast/main.go b/examples/broadcast/main.go index d6663e3e..74fef697 100644 --- a/examples/broadcast/main.go +++ b/examples/broadcast/main.go @@ -64,18 +64,6 @@ 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 { diff --git a/examples/reflect/main.go b/examples/reflect/main.go index 668e2969..0e667bab 100644 --- a/examples/reflect/main.go +++ b/examples/reflect/main.go @@ -110,18 +110,6 @@ func main() { } }() - // 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 - } - } - }() - fmt.Printf("Track has started, of type %d: %s \n", track.PayloadType(), track.Codec().MimeType) for { // Read RTP packets being sent to Pion diff --git a/examples/rtp-forwarder/main.go b/examples/rtp-forwarder/main.go index ffe61538..ebce7442 100644 --- a/examples/rtp-forwarder/main.go +++ b/examples/rtp-forwarder/main.go @@ -132,18 +132,6 @@ func main() { } }() - // 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 - } - } - }() - b := make([]byte, 1500) rtpPacket := &rtp.Packet{} for { diff --git a/examples/save-to-disk/main.go b/examples/save-to-disk/main.go index 59448beb..c657f218 100644 --- a/examples/save-to-disk/main.go +++ b/examples/save-to-disk/main.go @@ -116,18 +116,6 @@ func main() { } }() - // 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 - } - } - }() - codec := track.Codec() if strings.EqualFold(codec.MimeType, webrtc.MimeTypeOpus) { fmt.Println("Got Opus track, saving to disk as output.opus (48 kHz, 2 channels)") diff --git a/examples/simulcast/main.go b/examples/simulcast/main.go index ca1827da..2e41f683 100644 --- a/examples/simulcast/main.go +++ b/examples/simulcast/main.go @@ -123,6 +123,8 @@ func main() { peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) { fmt.Println("Track has started") + // Start reading from all the streams and sending them to the related output track + rid := track.RID() go func() { ticker := time.NewTicker(3 * time.Second) for range ticker.C { @@ -132,21 +134,6 @@ func main() { } } }() - - // 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 - } - } - }() - - // Start reading from all the streams and sending them to the related output track - rid := track.RID() for { // Read RTP packets being sent to Pion packet, _, readErr := track.ReadRTP() diff --git a/examples/swap-tracks/main.go b/examples/swap-tracks/main.go index ddf12d4c..90ab309d 100644 --- a/examples/swap-tracks/main.go +++ b/examples/swap-tracks/main.go @@ -80,18 +80,6 @@ func main() { // nolint:gocognit // Set a handler for when a new remote track starts peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) { - // 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 - } - } - }() - fmt.Printf("Track has started, of type %d: %s \n", track.PayloadType(), track.Codec().MimeType) trackNum := trackCount trackCount++