Skip to content

Commit 6f9d002

Browse files
committed
Remove ugly RTCP handling
Signed-off-by: Šimon Brandner <[email protected]>
1 parent 78e9e99 commit 6f9d002

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

pkg/peer/webrtc.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,14 @@ package peer
33
import (
44
"errors"
55
"io"
6-
"time"
76

8-
"github.com/pion/rtcp"
97
"github.com/pion/webrtc/v3"
108
"maunium.net/go/mautrix/event"
119
)
1210

1311
// A callback that is called once we receive first RTP packets from a track, i.e.
1412
// we call this function each time a new track is received.
1513
func (p *Peer[ID]) onRtpTrackReceived(remoteTrack *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
16-
// Send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval.
17-
// This can be less wasteful by processing incoming RTCP events, then we would emit a NACK/PLI
18-
// when a viewer requests it.
19-
//
20-
// TODO: Add RTCP handling based on the PR from @SimonBrandner.
21-
go func() {
22-
ticker := time.NewTicker(time.Millisecond * 500) // every 500ms
23-
for range ticker.C {
24-
rtcp := []rtcp.Packet{&rtcp.PictureLossIndication{MediaSSRC: uint32(remoteTrack.SSRC())}}
25-
if err := p.peerConnection.WriteRTCP(rtcp); err != nil && !errors.Is(err, io.ErrClosedPipe) {
26-
p.logger.Errorf("Failed to send RTCP PLI: %v", err)
27-
return
28-
}
29-
}
30-
}()
31-
3214
// Create a local track, all our SFU clients that are subscribed to this
3315
// peer (publisher) wil be fed via this track.
3416
localTrack, err := webrtc.NewTrackLocalStaticRTP(

0 commit comments

Comments
 (0)