Add a resync API to sfu.DownTrack (#389)

* Add a resync API to sfu.DownTrack

Also passing in logger with context into sfu package. More to do here
with proper logging context in all modules, but this is a start

* Remove debug code

* fix tests
This commit is contained in:
Raja Subramanian
2022-01-30 10:59:47 +05:30
committed by GitHub
parent 7ac3631b6c
commit a1f88faed1
10 changed files with 141 additions and 68 deletions
+1
View File
@@ -112,6 +112,7 @@ func NewMediaTrack(track *webrtc.TrackRemote, params MediaTrackParams) *MediaTra
publishing, expected := t.getNumUpTracks()
return publishing < expected
},
Logger: t.params.Logger,
})
t.connectionStats.OnStatsUpdate(func(_cs *connectionquality.ConnectionStats, stat *livekit.AnalyticsStat) {
t.params.Telemetry.TrackStats(livekit.StreamType_UPSTREAM, t.PublisherID(), t.ID(), stat)
+22 -7
View File
@@ -114,13 +114,20 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, code
case livekit.TrackType_VIDEO:
rtcpFeedback = t.params.SubscriberConfig.RTCPFeedback.Video
}
downTrack, err := sfu.NewDownTrack(webrtc.RTPCodecCapability{
MimeType: codec.MimeType,
ClockRate: codec.ClockRate,
Channels: codec.Channels,
SDPFmtpLine: codec.SDPFmtpLine,
RTCPFeedback: rtcpFeedback,
}, wr, t.params.BufferFactory, subscriberID, t.params.ReceiverConfig.PacketBufferSize)
downTrack, err := sfu.NewDownTrack(
webrtc.RTPCodecCapability{
MimeType: codec.MimeType,
ClockRate: codec.ClockRate,
Channels: codec.Channels,
SDPFmtpLine: codec.SDPFmtpLine,
RTCPFeedback: rtcpFeedback,
},
wr,
t.params.BufferFactory,
subscriberID,
t.params.ReceiverConfig.PacketBufferSize,
LoggerWithParticipant(t.params.Logger, sub.Identity(), sub.ID()),
)
if err != nil {
return nil, err
}
@@ -272,6 +279,14 @@ func (t *MediaTrackSubscriptions) RemoveAllSubscribers() {
}
}
func (t *MediaTrackSubscriptions) ResyncAllSubscribers() {
t.params.Logger.Debugw("resyncing all subscribers")
for _, subTrack := range t.getAllSubscribedTracks() {
subTrack.DownTrack().Resync()
}
}
func (t *MediaTrackSubscriptions) RevokeDisallowedSubscribers(allowedSubscriberIDs []livekit.ParticipantID) []livekit.ParticipantID {
var revokedSubscriberIDs []livekit.ParticipantID