2016-09-12 16:04:43 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-06-21 16:16:38 +02:00
|
|
|
#ifndef MODULES_VIDEO_CODING_UTILITY_SIMULCAST_RATE_ALLOCATOR_H_
|
|
|
|
|
#define MODULES_VIDEO_CODING_UTILITY_SIMULCAST_RATE_ALLOCATOR_H_
|
2016-09-12 16:04:43 +02:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stddef.h>
|
2017-01-02 08:42:32 -08:00
|
|
|
#include <stdint.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2018-03-19 18:25:10 +01:00
|
|
|
#include <vector>
|
2016-09-12 16:04:43 +02:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/video/video_bitrate_allocation.h"
|
2018-07-20 15:49:43 -07:00
|
|
|
#include "api/video/video_bitrate_allocator.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/video_codecs/video_codec.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/constructor_magic.h"
|
2019-10-30 13:01:46 +01:00
|
|
|
#include "rtc_base/experiments/rate_control_settings.h"
|
2019-09-04 16:30:47 +02:00
|
|
|
#include "rtc_base/experiments/stable_target_rate_experiment.h"
|
2016-09-12 16:04:43 +02:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2018-03-21 09:57:23 +01:00
|
|
|
class SimulcastRateAllocator : public VideoBitrateAllocator {
|
2016-09-12 16:04:43 +02:00
|
|
|
public:
|
2018-03-21 09:57:23 +01:00
|
|
|
explicit SimulcastRateAllocator(const VideoCodec& codec);
|
2018-09-13 18:09:58 +02:00
|
|
|
~SimulcastRateAllocator() override;
|
2016-11-16 16:41:30 +01:00
|
|
|
|
2019-08-02 15:16:28 +02:00
|
|
|
VideoBitrateAllocation Allocate(
|
|
|
|
|
VideoBitrateAllocationParameters parameters) override;
|
2016-09-12 16:04:43 +02:00
|
|
|
const VideoCodec& GetCodec() const;
|
|
|
|
|
|
2019-10-30 13:01:46 +01:00
|
|
|
static float GetTemporalRateAllocation(int num_layers,
|
|
|
|
|
int temporal_id,
|
|
|
|
|
bool base_heavy_tl3_alloc);
|
2018-07-04 10:07:40 +02:00
|
|
|
|
2020-08-04 11:40:23 +02:00
|
|
|
void SetLegacyConferenceMode(bool mode) override;
|
|
|
|
|
|
2016-09-12 16:04:43 +02:00
|
|
|
private:
|
2018-01-18 10:39:54 -08:00
|
|
|
void DistributeAllocationToSimulcastLayers(
|
2019-09-04 16:30:47 +02:00
|
|
|
DataRate total_bitrate,
|
|
|
|
|
DataRate stable_bitrate,
|
|
|
|
|
VideoBitrateAllocation* allocated_bitrates);
|
2018-01-18 10:39:54 -08:00
|
|
|
void DistributeAllocationToTemporalLayers(
|
2019-09-04 16:30:47 +02:00
|
|
|
VideoBitrateAllocation* allocated_bitrates) const;
|
2018-03-19 18:25:10 +01:00
|
|
|
std::vector<uint32_t> DefaultTemporalLayerAllocation(int bitrate_kbps,
|
|
|
|
|
int max_bitrate_kbps,
|
|
|
|
|
int simulcast_id) const;
|
|
|
|
|
std::vector<uint32_t> ScreenshareTemporalLayerAllocation(
|
|
|
|
|
int bitrate_kbps,
|
|
|
|
|
int max_bitrate_kbps,
|
|
|
|
|
int simulcast_id) const;
|
|
|
|
|
int NumTemporalStreams(size_t simulcast_id) const;
|
|
|
|
|
|
2016-09-12 16:04:43 +02:00
|
|
|
const VideoCodec codec_;
|
2019-09-04 16:30:47 +02:00
|
|
|
const StableTargetRateExperiment stable_rate_settings_;
|
2019-10-30 13:01:46 +01:00
|
|
|
const RateControlSettings rate_control_settings_;
|
2018-09-13 18:09:58 +02:00
|
|
|
std::vector<bool> stream_enabled_;
|
2020-08-04 11:40:23 +02:00
|
|
|
bool legacy_conference_mode_;
|
2016-09-12 16:04:43 +02:00
|
|
|
|
|
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(SimulcastRateAllocator);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2018-06-21 16:16:38 +02:00
|
|
|
#endif // MODULES_VIDEO_CODING_UTILITY_SIMULCAST_RATE_ALLOCATOR_H_
|