Skip to content

Commit

Permalink
Simplify lastPLITimestamp
Browse files Browse the repository at this point in the history
Signed-off-by: Šimon Brandner <[email protected]>
  • Loading branch information
SimonBrandner authored and daniel-abramov committed Dec 5, 2022
1 parent 2649e1f commit 0369070
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
16 changes: 5 additions & 11 deletions pkg/conference/peer_message_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package conference

import (
"encoding/json"
"time"

"github.com/matrix-org/waterfall/pkg/peer"
"github.com/pion/webrtc/v3"
Expand Down Expand Up @@ -117,17 +118,10 @@ func (c *Conference) processForwardRTCPMessage(msg peer.RTCPReceived) {
for _, participant := range c.participants {
for _, publishedTrack := range participant.publishedTracks {
if publishedTrack.track.StreamID() == msg.StreamID && publishedTrack.track.ID() == msg.TrackID {
participant.peer.WriteRTCP(msg.Packets, msg.StreamID, msg.TrackID, publishedTrack.lastPLITimestamp)
}
}
}
}

func (c *Conference) processPLISentMessage(msg peer.PLISent) {
for _, participant := range c.participants {
for _, publishedTrack := range participant.publishedTracks {
if publishedTrack.track.StreamID() == msg.StreamID && publishedTrack.track.ID() == msg.TrackID {
publishedTrack.lastPLITimestamp = msg.Timestamp
err := participant.peer.WriteRTCP(msg.Packets, msg.StreamID, msg.TrackID, publishedTrack.lastPLITimestamp)
if err == nil {
publishedTrack.lastPLITimestamp = time.Now()
}
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/peer/messages.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package peer

import (
"time"

"github.com/pion/rtcp"
"github.com/pion/webrtc/v3"
"maunium.net/go/mautrix/event"
Expand Down Expand Up @@ -47,9 +45,3 @@ type RTCPReceived struct {
StreamID string
TrackID string
}

type PLISent struct {
Timestamp time.Time
StreamID string
TrackID string
}
2 changes: 0 additions & 2 deletions pkg/peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ func (p *Peer[ID]) WriteRTCP(packets []rtcp.Packet, streamID string, trackID str
continue
}

p.sink.Send(PLISent{Timestamp: time.Now(), StreamID: streamID, TrackID: trackID})

typedPacket.MediaSSRC = mediaSSRC
packetsToSend = append(packetsToSend, typedPacket)
case *rtcp.FullIntraRequest:
Expand Down

0 comments on commit 0369070

Please sign in to comment.