Commit 78d3b7ab authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Simplify sendPLI.

We use identical SSRC values on both sides, no need to map.
parent c86b1c87
...@@ -460,9 +460,9 @@ func rtcpListener(g *group, c *downConnection, s *webrtc.RTPSender) { ...@@ -460,9 +460,9 @@ func rtcpListener(g *group, c *downConnection, s *webrtc.RTPSender) {
for _, p := range ps { for _, p := range ps {
switch p := p.(type) { switch p := p.(type) {
case *rtcp.PictureLossIndication: case *rtcp.PictureLossIndication:
err := sendPli(g, s.Track(), c.remote) err := sendPLI(c.remote, p.MediaSSRC)
if err != nil { if err != nil {
log.Printf("sendPli: %v", err) log.Printf("sendPLI: %v", err)
} }
case *rtcp.ReceiverEstimatedMaximumBitrate: case *rtcp.ReceiverEstimatedMaximumBitrate:
bitrate := uint32(math.MaxInt32) bitrate := uint32(math.MaxInt32)
...@@ -549,22 +549,10 @@ func updateBitrate(g *group, up *upConnection) (uint32, uint32) { ...@@ -549,22 +549,10 @@ func updateBitrate(g *group, up *upConnection) (uint32, uint32) {
return audio, video return audio, video
} }
func sendPli(g *group, local *webrtc.Track, up *upConnection) error { func sendPLI(up *upConnection, ssrc uint32) error {
var track *webrtc.Track // we use equal SSRC values on both sides
for _, p := range up.pairs {
if p.local == local {
track = p.remote
break
}
}
if track == nil {
return errors.New("attempted to send PLI for unknown track")
}
return up.pc.WriteRTCP([]rtcp.Packet{ return up.pc.WriteRTCP([]rtcp.Packet{
&rtcp.PictureLossIndication{MediaSSRC: track.SSRC()}, &rtcp.PictureLossIndication{MediaSSRC: ssrc},
}) })
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment