Add hysteresis to enabling of simulcast streams.

If the bandwidth is just on the edge of being able to enable a new
stream, the keyframe generated when it is enabled might be large enough
to trigger an overuse and force the stream off again.

To avoid toggling, this CL adds hysteresis so that the available
bandwidth needs to be above X% to start bitrate in order to enable the
stream. It will be shut down once available bitrate falls below the
original enabling bitrate.

For screen content, X defaults to 35.
For realtime content, X defaults to 0.

Both can be individually modified via field trials.

Bug: webrtc:9734
Change-Id: I941332d7be7f2a801d13d9202b2076d330e7df32
Reviewed-on: https://webrtc-review.googlesource.com/100308
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24745}
This commit is contained in:
Erik Språng
2018-09-13 18:09:58 +02:00
committed by Commit Bot
parent 60570dc8c4
commit 3064f31ce4
3 changed files with 184 additions and 38 deletions

View File

@ -27,6 +27,7 @@ namespace webrtc {
class SimulcastRateAllocator : public VideoBitrateAllocator {
public:
explicit SimulcastRateAllocator(const VideoCodec& codec);
~SimulcastRateAllocator() override;
VideoBitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
uint32_t framerate) override;
@ -37,7 +38,7 @@ class SimulcastRateAllocator : public VideoBitrateAllocator {
private:
void DistributeAllocationToSimulcastLayers(
uint32_t total_bitrate_bps,
VideoBitrateAllocation* allocated_bitrates_bps) const;
VideoBitrateAllocation* allocated_bitrates_bps);
void DistributeAllocationToTemporalLayers(
uint32_t framerate,
VideoBitrateAllocation* allocated_bitrates_bps) const;
@ -53,6 +54,8 @@ class SimulcastRateAllocator : public VideoBitrateAllocator {
int NumTemporalStreams(size_t simulcast_id) const;
const VideoCodec codec_;
const double hysteresis_factor_;
std::vector<bool> stream_enabled_;
RTC_DISALLOW_COPY_AND_ASSIGN(SimulcastRateAllocator);
};