Add fps calculator for VP8 and DependencyDescriptor (#1110)

* Add fps calculator for VP8 and DependencyDescriptor

* clean code

* unit test

* clean code

* solve comment
This commit is contained in:
cnderrauber
2022-10-26 09:28:28 +08:00
committed by GitHub
parent 96a058b503
commit 7a7fc09372
17 changed files with 1040 additions and 35 deletions
+16
View File
@@ -809,4 +809,20 @@ func (t *MediaTrackReceiver) SetRTT(rtt uint32) {
}
}
func (t *MediaTrackReceiver) GetTemporalLayerForSpatialFps(spatial int32, fps uint32, mime string) int32 {
receiver := t.Receiver(mime)
if receiver == nil {
return buffer.DefaultMaxLayerTemporal
}
layerFps := receiver.GetTemporalLayerFpsForSpatial(spatial)
requestFps := float32(fps) * layerSelectionTolerance
for i, f := range layerFps {
if requestFps <= f {
return int32(i)
}
}
return buffer.DefaultMaxLayerTemporal
}
// ---------------------------