Commit 77b2e6e1 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Pass a track to the RTCP listener.

parent 4b854e3a
...@@ -481,7 +481,7 @@ func addDownTrack(c *client, id string, remoteTrack *upTrack, remoteConn *upConn ...@@ -481,7 +481,7 @@ func addDownTrack(c *client, id string, remoteTrack *upTrack, remoteConn *upConn
conn.tracks = append(conn.tracks, track) conn.tracks = append(conn.tracks, track)
remoteTrack.addLocal(track) remoteTrack.addLocal(track)
go rtcpListener(c.group, conn, s, track.maxBitrate) go rtcpListener(c.group, conn, track, s)
return conn, s, nil return conn, s, nil
} }
...@@ -492,7 +492,7 @@ func msSinceEpoch() uint64 { ...@@ -492,7 +492,7 @@ func msSinceEpoch() uint64 {
return uint64(time.Since(epoch) / time.Millisecond) return uint64(time.Since(epoch) / time.Millisecond)
} }
func rtcpListener(g *group, c *downConnection, s *webrtc.RTPSender, bitrate *timeStampedBitrate) { func rtcpListener(g *group, conn *downConnection, track *downTrack, s *webrtc.RTPSender) {
for { for {
ps, err := s.ReadRTCP() ps, err := s.ReadRTCP()
if err != nil { if err != nil {
...@@ -505,7 +505,7 @@ func rtcpListener(g *group, c *downConnection, s *webrtc.RTPSender, bitrate *tim ...@@ -505,7 +505,7 @@ func rtcpListener(g *group, c *downConnection, s *webrtc.RTPSender, bitrate *tim
for _, p := range ps { for _, p := range ps {
switch p := p.(type) { switch p := p.(type) {
case *rtcp.PictureLossIndication: case *rtcp.PictureLossIndication:
err := sendPLI(c.remote.pc, p.MediaSSRC) err := sendPLI(conn.remote.pc, p.MediaSSRC)
if err != nil { if err != nil {
log.Printf("sendPLI: %v", err) log.Printf("sendPLI: %v", err)
} }
...@@ -515,11 +515,11 @@ func rtcpListener(g *group, c *downConnection, s *webrtc.RTPSender, bitrate *tim ...@@ -515,11 +515,11 @@ func rtcpListener(g *group, c *downConnection, s *webrtc.RTPSender, bitrate *tim
// data between the two writes. This shouldn't // data between the two writes. This shouldn't
// matter, we'll recover at the next sample. // matter, we'll recover at the next sample.
atomic.StoreUint64( atomic.StoreUint64(
&bitrate.bitrate, &track.maxBitrate.bitrate,
p.Bitrate, p.Bitrate,
) )
atomic.StoreUint64( atomic.StoreUint64(
&bitrate.timestamp, &track.maxBitrate.timestamp,
uint64(ms), uint64(ms),
) )
case *rtcp.ReceiverReport: case *rtcp.ReceiverReport:
......
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