Skip to content

Commit d0f842c

Browse files
committed
Simplify lastPLITimestamp
Signed-off-by: Šimon Brandner <[email protected]>
1 parent 2ece4d7 commit d0f842c

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

pkg/conference/peer_message_processor.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package conference
22

33
import (
44
"encoding/json"
5+
"time"
56

67
"github.com/matrix-org/waterfall/pkg/peer"
78
"github.com/pion/webrtc/v3"
@@ -117,17 +118,10 @@ func (c *Conference) processForwardRTCPMessage(msg peer.RTCPReceived) {
117118
for _, participant := range c.participants {
118119
for _, publishedTrack := range participant.publishedTracks {
119120
if publishedTrack.track.StreamID() == msg.StreamID && publishedTrack.track.ID() == msg.TrackID {
120-
participant.peer.WriteRTCP(msg.Packets, msg.StreamID, msg.TrackID, publishedTrack.lastPLITimestamp)
121-
}
122-
}
123-
}
124-
}
125-
126-
func (c *Conference) processPLISentMessage(msg peer.PLISent) {
127-
for _, participant := range c.participants {
128-
for _, publishedTrack := range participant.publishedTracks {
129-
if publishedTrack.track.StreamID() == msg.StreamID && publishedTrack.track.ID() == msg.TrackID {
130-
publishedTrack.lastPLITimestamp = msg.Timestamp
121+
err := participant.peer.WriteRTCP(msg.Packets, msg.StreamID, msg.TrackID, publishedTrack.lastPLITimestamp)
122+
if err == nil {
123+
publishedTrack.lastPLITimestamp = time.Now()
124+
}
131125
}
132126
}
133127
}

pkg/peer/messages.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package peer
22

33
import (
4-
"time"
5-
64
"github.com/pion/rtcp"
75
"github.com/pion/webrtc/v3"
86
"maunium.net/go/mautrix/event"
@@ -47,9 +45,3 @@ type RTCPReceived struct {
4745
StreamID string
4846
TrackID string
4947
}
50-
51-
type PLISent struct {
52-
Timestamp time.Time
53-
StreamID string
54-
TrackID string
55-
}

pkg/peer/peer.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ func (p *Peer[ID]) WriteRTCP(packets []rtcp.Packet, streamID string, trackID str
151151
continue
152152
}
153153

154-
p.sink.Send(PLISent{Timestamp: time.Now(), StreamID: streamID, TrackID: trackID})
155-
156154
typedPacket.MediaSSRC = mediaSSRC
157155
packetsToSend = append(packetsToSend, typedPacket)
158156
case *rtcp.FullIntraRequest:

0 commit comments

Comments
 (0)