mirror of
https://github.com/pion/webrtc.git
synced 2025-10-03 14:26:25 +08:00
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:
@@ -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 {
|
||||
|
@@ -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
|
||||
|
@@ -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 {
|
||||
|
@@ -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)")
|
||||
|
@@ -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()
|
||||
|
@@ -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++
|
||||
|
Reference in New Issue
Block a user