Adjust interfaces to better work with cloud (#349)

* Adjust interfaces to better work with cloud

* force argument to quality update
This commit is contained in:
Raja Subramanian
2022-01-19 10:28:55 +05:30
committed by GitHub
parent 8a5f26b064
commit 10714b3f6d
7 changed files with 247 additions and 142 deletions
+2 -30
View File
@@ -848,34 +848,6 @@ func (p *ParticipantImpl) SubscriptionPermissionUpdate(publisherID livekit.Parti
}
}
func (p *ParticipantImpl) UpdateSubscribedQuality(nodeID string, trackID livekit.TrackID, maxQuality livekit.VideoQuality) error {
track := p.GetPublishedTrack(trackID)
if track == nil {
p.params.Logger.Warnw("could not find track", nil, "trackID", trackID)
return errors.New("could not find track")
}
if mt, ok := track.(*MediaTrack); ok {
mt.NotifySubscriberNodeMaxQuality(nodeID, maxQuality)
}
return nil
}
func (p *ParticipantImpl) UpdateMediaLoss(nodeID string, trackID livekit.TrackID, fractionalLoss uint32) error {
track := p.GetPublishedTrack(trackID)
if track == nil {
p.params.Logger.Warnw("could not find track", nil, "trackID", trackID)
return errors.New("could not find track")
}
if mt, ok := track.(*MediaTrack); ok {
mt.NotifySubscriberNodeMediaLoss(nodeID, uint8(fractionalLoss))
}
return nil
}
func (p *ParticipantImpl) setupUptrackManager() {
p.UptrackManager = NewUptrackManager(UptrackManagerParams{
SID: p.params.SID,
@@ -892,8 +864,6 @@ func (p *ParticipantImpl) setupUptrackManager() {
}
})
p.UptrackManager.OnSubscribedMaxQualityChange(p.onSubscribedMaxQualityChange)
p.UptrackManager.OnUptrackManagerClose(p.onUptrackManagerClose)
}
@@ -1375,6 +1345,8 @@ func (p *ParticipantImpl) mediaTrackReceived(track *webrtc.TrackRemote, rtpRecei
}
}
mt.OnSubscribedMaxQualityChange(p.onSubscribedMaxQualityChange)
// add to published and clean up pending
p.UptrackManager.AddPublishedTrack(mt)
delete(p.pendingTracks, signalCid)