Revert "Process RTCP Packets in OnTrack examples"

This is not needed. We don't perform any operations on inbound RTCP
packets. Receiver Reports and TWCC are generated by Reading RTP packets.

This reverts commit 080d7b8427.
This commit is contained in:
Sean DuBois
2021-12-29 23:39:32 -05:00
parent 425f5c6cef
commit fe447d6e56
6 changed files with 2 additions and 75 deletions

View File

@@ -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 {

View File

@@ -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

View File

@@ -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 {

View File

@@ -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)")

View File

@@ -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()

View File

@@ -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++