Use current layer for actual dimension when calculating quality of muxed (#773)
tracks.
This commit is contained in:
@@ -27,6 +27,7 @@ type ConnectionStatsParams struct {
|
|||||||
IsDtxDisabled func() bool
|
IsDtxDisabled func() bool
|
||||||
GetLayerDimension func(int32) (uint32, uint32)
|
GetLayerDimension func(int32) (uint32, uint32)
|
||||||
GetMaxExpectedLayer func() *livekit.VideoLayer
|
GetMaxExpectedLayer func() *livekit.VideoLayer
|
||||||
|
GetCurrentLayerSpatial func() int32
|
||||||
GetIsReducedQuality func() bool
|
GetIsReducedQuality func() bool
|
||||||
Logger logger.Logger
|
Logger logger.Logger
|
||||||
}
|
}
|
||||||
@@ -130,6 +131,15 @@ func (cs *ConnectionStats) updateScore(streams map[uint32]*buffer.StreamStatsWit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if maxAvailableLayerStats != nil {
|
if maxAvailableLayerStats != nil {
|
||||||
|
// for muxed tracks, i. e. simulcast publisher muxed into a single track,
|
||||||
|
// use the current spatial layer.
|
||||||
|
// NOTE: This is still not perfect as muxing means layers could have changed
|
||||||
|
// in the analysis window. Needs a more complex design to keep track of all layer
|
||||||
|
// switches to be able to do precise calculations. As the window is small,
|
||||||
|
// using the current and maximum is a reasonable approximation.
|
||||||
|
if cs.params.GetCurrentLayerSpatial != nil {
|
||||||
|
maxAvailableLayer = cs.params.GetCurrentLayerSpatial()
|
||||||
|
}
|
||||||
params.ActualWidth, params.ActualHeight = cs.params.GetLayerDimension(maxAvailableLayer)
|
params.ActualWidth, params.ActualHeight = cs.params.GetLayerDimension(maxAvailableLayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -233,6 +233,9 @@ func NewDownTrack(
|
|||||||
width, height := d.receiver.GetLayerDimension(maxLayer)
|
width, height := d.receiver.GetLayerDimension(maxLayer)
|
||||||
return &livekit.VideoLayer{Quality: utils.QualityForSpatialLayer(maxLayer), Width: width, Height: height}
|
return &livekit.VideoLayer{Quality: utils.QualityForSpatialLayer(maxLayer), Width: width, Height: height}
|
||||||
},
|
},
|
||||||
|
GetCurrentLayerSpatial: func() int32 {
|
||||||
|
return d.forwarder.CurrentLayers().Spatial
|
||||||
|
},
|
||||||
GetIsReducedQuality: func() bool {
|
GetIsReducedQuality: func() bool {
|
||||||
return d.GetForwardingStatus() != ForwardingStatusOptimal
|
return d.GetForwardingStatus() != ForwardingStatusOptimal
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user