#include "video/config/simulcast.h"
#include <stdint.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/field_trials_view.h"
#include "api/video/video_codec_constants.h"
#include "media/base/media_constants.h"
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
#include "rtc_base/checks.h"
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/experiments/min_video_bitrate_experiment.h"
#include "rtc_base/experiments/normalize_simulcast_size_experiment.h"
#include "rtc_base/experiments/rate_control_settings.h"
#include "rtc_base/logging.h"
namespace cricket {
namespace {
FieldTrialsView;
constexpr char kUseLegacySimulcastLayerLimitFieldTrial[] = …;
constexpr double kDefaultMaxRoundupRate = …;
constexpr webrtc::DataRate kScreenshareDefaultTl0Bitrate = …;
constexpr webrtc::DataRate kScreenshareDefaultTl1Bitrate = …;
constexpr webrtc::DataRate kScreenshareHighStreamMinBitrate = …;
constexpr webrtc::DataRate kScreenshareHighStreamMaxBitrate = …;
constexpr int kDefaultNumTemporalLayers = …;
constexpr int kScreenshareMaxSimulcastLayers = …;
constexpr int kScreenshareTemporalLayers = …;
struct SimulcastFormat { … };
constexpr const SimulcastFormat kSimulcastFormatsVP8[] = …;
constexpr const SimulcastFormat kSimulcastFormatsVP9[] = …;
constexpr webrtc::DataRate Interpolate(const webrtc::DataRate& a,
const webrtc::DataRate& b,
float rate) { … }
bool EnableLowresBitrateInterpolation(const webrtc::FieldTrialsView& trials) { … }
std::vector<SimulcastFormat> GetSimulcastFormats(
bool enable_lowres_bitrate_interpolation,
webrtc::VideoCodecType codec) { … }
int FindSimulcastFormatIndex(int width,
int height,
bool enable_lowres_bitrate_interpolation,
webrtc::VideoCodecType codec) { … }
SimulcastFormat InterpolateSimulcastFormat(
int width,
int height,
absl::optional<double> max_roundup_rate,
bool enable_lowres_bitrate_interpolation,
webrtc::VideoCodecType codec) { … }
std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
rtc::ArrayView<const webrtc::Resolution> resolutions,
bool temporal_layers_supported,
bool base_heavy_tl3_rate_alloc,
const webrtc::FieldTrialsView& trials,
webrtc::VideoCodecType codec) { … }
std::vector<webrtc::VideoStream> GetScreenshareLayers(
size_t max_layers,
int width,
int height,
bool temporal_layers_supported,
bool base_heavy_tl3_rate_alloc,
const webrtc::FieldTrialsView& trials) { … }
}
size_t LimitSimulcastLayerCount(size_t min_num_layers,
size_t max_num_layers,
int width,
int height,
const webrtc::FieldTrialsView& trials,
webrtc::VideoCodecType codec) { … }
void BoostMaxSimulcastLayer(webrtc::DataRate max_bitrate,
std::vector<webrtc::VideoStream>* layers) { … }
webrtc::DataRate GetTotalMaxBitrate(
const std::vector<webrtc::VideoStream>& layers) { … }
std::vector<webrtc::VideoStream> GetSimulcastConfig(
rtc::ArrayView<const webrtc::Resolution> resolutions,
bool is_screenshare_with_conference_mode,
bool temporal_layers_supported,
const webrtc::FieldTrialsView& trials,
webrtc::VideoCodecType codec) { … }
}