Use current layer for actual dimension when calculating quality of muxed (#773)
tracks.
This commit is contained in:
@@ -19,16 +19,17 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ConnectionStatsParams struct {
|
type ConnectionStatsParams struct {
|
||||||
UpdateInterval time.Duration
|
UpdateInterval time.Duration
|
||||||
CodecType webrtc.RTPCodecType
|
CodecType webrtc.RTPCodecType
|
||||||
CodecName string
|
CodecName string
|
||||||
MimeType string
|
MimeType string
|
||||||
GetDeltaStats func() map[uint32]*buffer.StreamStatsWithLayers
|
GetDeltaStats func() map[uint32]*buffer.StreamStatsWithLayers
|
||||||
IsDtxDisabled func() bool
|
IsDtxDisabled func() bool
|
||||||
GetLayerDimension func(int32) (uint32, uint32)
|
GetLayerDimension func(int32) (uint32, uint32)
|
||||||
GetMaxExpectedLayer func() *livekit.VideoLayer
|
GetMaxExpectedLayer func() *livekit.VideoLayer
|
||||||
GetIsReducedQuality func() bool
|
GetCurrentLayerSpatial func() int32
|
||||||
Logger logger.Logger
|
GetIsReducedQuality func() bool
|
||||||
|
Logger logger.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConnectionStats struct {
|
type ConnectionStats struct {
|
||||||
@@ -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