Set DtxDisabled from TrackInfo in score calculation. (#770)

* Set DtxDisabled from TrackInfo in score calculation.

Also, fix sending connection quality upate on a new subscription.

* comments tweaks

* Move TrackInfo into StreamTrackerManager as this is used by cloud as well
This commit is contained in:
Raja Subramanian
2022-06-19 21:12:09 +05:30
committed by GitHub
parent 227247b012
commit 62943f2096
6 changed files with 109 additions and 83 deletions
+10 -2
View File
@@ -253,9 +253,9 @@ func (r *Room) Join(participant types.LocalParticipant, opts *ParticipantOptions
participant.OnParticipantUpdate(r.onParticipantUpdate)
participant.OnDataPacket(r.onDataPacket)
participant.OnSubscribedTo(func(p types.LocalParticipant, publisherID livekit.ParticipantID) {
// when a participant subscribed to another participant,
// send speaker update if the subscribed to participant is active.
go func() {
// when a participant subscribes to another participant,
// send speaker update if the subscribed to participant is active.
speakers := r.GetActiveSpeakers()
for _, speaker := range speakers {
if livekit.ParticipantID(speaker.Sid) == publisherID {
@@ -263,6 +263,14 @@ func (r *Room) Join(participant types.LocalParticipant, opts *ParticipantOptions
break
}
}
// send connection quality of subscribed to participant
pub := r.GetParticipantBySid(publisherID)
if pub != nil && pub.State() == livekit.ParticipantInfo_ACTIVE {
update := &livekit.ConnectionQualityUpdate{}
update.Updates = append(update.Updates, pub.GetConnectionQuality())
p.SendConnectionQualityUpdate(update)
}
}()
})
r.Logger.Infow("new participant joined",
+7
View File
@@ -191,3 +191,10 @@ func (d *DumbReceiver) GetLayerDimension(quality int32) (uint32, uint32) {
}
return 0, 0
}
func (d *DumbReceiver) IsDtxDisabled() bool {
if r, ok := d.receiver.Load().(sfu.TrackReceiver); ok {
return r.IsDtxDisabled()
}
return false
}