diff --git a/pkg/conference/peer_message_processor.go b/pkg/conference/peer_message_processor.go index 1b5d949..a815972 100644 --- a/pkg/conference/peer_message_processor.go +++ b/pkg/conference/peer_message_processor.go @@ -2,6 +2,7 @@ package conference import ( "encoding/json" + "time" "github.com/matrix-org/waterfall/pkg/peer" "github.com/pion/webrtc/v3" @@ -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() + } } } } diff --git a/pkg/peer/messages.go b/pkg/peer/messages.go index 08b0f20..0593d72 100644 --- a/pkg/peer/messages.go +++ b/pkg/peer/messages.go @@ -1,8 +1,6 @@ package peer import ( - "time" - "github.com/pion/rtcp" "github.com/pion/webrtc/v3" "maunium.net/go/mautrix/event" @@ -47,9 +45,3 @@ type RTCPReceived struct { StreamID string TrackID string } - -type PLISent struct { - Timestamp time.Time - StreamID string - TrackID string -} diff --git a/pkg/peer/peer.go b/pkg/peer/peer.go index 0909504..a226633 100644 --- a/pkg/peer/peer.go +++ b/pkg/peer/peer.go @@ -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: