Update VideoBitrateAllocator allocate to take a struct with more fields

We want to evaluate more data in order to make better choices in the
bitrate allocators.
In order to freely update the parameter list without
breaking the API many times for projects customizing them, we'll use a
struct instead.

Bug: webrtc:10126
Change-Id: I443f86781c5134950294cdd1e3197a47447cf973
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141418
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28748}
This commit is contained in:
Florent Castelli
2019-08-02 15:16:28 +02:00
committed by Commit Bot
parent 9a9f18a736
commit 8bbdb5b9bd
25 changed files with 232 additions and 112 deletions

View File

@ -13,6 +13,7 @@
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <numeric>
#include <string>
@ -63,13 +64,13 @@ SimulcastRateAllocator::SimulcastRateAllocator(const VideoCodec& codec)
SimulcastRateAllocator::~SimulcastRateAllocator() = default;
VideoBitrateAllocation SimulcastRateAllocator::GetAllocation(
uint32_t total_bitrate_bps,
uint32_t framerate) {
VideoBitrateAllocation SimulcastRateAllocator::Allocate(
VideoBitrateAllocationParameters parameters) {
VideoBitrateAllocation allocated_bitrates_bps;
DistributeAllocationToSimulcastLayers(total_bitrate_bps,
DistributeAllocationToSimulcastLayers(parameters.total_bitrate.bps(),
&allocated_bitrates_bps);
DistributeAllocationToTemporalLayers(framerate, &allocated_bitrates_bps);
DistributeAllocationToTemporalLayers(std::ceil(parameters.framerate),
&allocated_bitrates_bps);
return allocated_bitrates_bps;
}