Send layer dimensions when max subscribed layers change (#746)
Signed-off-by: shishir gowda <shishir@livekit.io>
This commit is contained in:
+20
-4
@@ -1355,15 +1355,31 @@ func (p *ParticipantImpl) onSubscribedMaxQualityChange(trackID livekit.TrackID,
|
|||||||
SubscribedQualities: subscribedQualities[0].Qualities, // for compatible with old client
|
SubscribedQualities: subscribedQualities[0].Qualities, // for compatible with old client
|
||||||
SubscribedCodecs: subscribedQualities,
|
SubscribedCodecs: subscribedQualities,
|
||||||
}
|
}
|
||||||
|
// get track's layer dimensions
|
||||||
|
track := p.UpTrackManager.GetPublishedTrack(trackID)
|
||||||
|
var layerInfo map[livekit.VideoQuality]*livekit.VideoLayer
|
||||||
|
if track != nil {
|
||||||
|
layers := track.ToProto().Layers
|
||||||
|
layerInfo = make(map[livekit.VideoQuality]*livekit.VideoLayer, len(layers))
|
||||||
|
for _, layer := range layers {
|
||||||
|
layerInfo[layer.Quality] = layer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, maxSubscribedQuality := range maxSubscribedQualites {
|
for _, maxSubscribedQuality := range maxSubscribedQualites {
|
||||||
|
ti := &livekit.TrackInfo{
|
||||||
|
Sid: string(trackID),
|
||||||
|
Type: livekit.TrackType_VIDEO,
|
||||||
|
}
|
||||||
|
if info, ok := layerInfo[maxSubscribedQuality.Quality]; ok {
|
||||||
|
ti.Width = info.Width
|
||||||
|
ti.Height = info.Height
|
||||||
|
}
|
||||||
|
|
||||||
p.params.Telemetry.TrackMaxSubscribedVideoQuality(
|
p.params.Telemetry.TrackMaxSubscribedVideoQuality(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
p.ID(),
|
p.ID(),
|
||||||
&livekit.TrackInfo{
|
ti,
|
||||||
Sid: string(trackID),
|
|
||||||
Type: livekit.TrackType_VIDEO,
|
|
||||||
},
|
|
||||||
maxSubscribedQuality.CodecMime,
|
maxSubscribedQuality.CodecMime,
|
||||||
maxSubscribedQuality.Quality,
|
maxSubscribedQuality.Quality,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user