#include "video/config/encoder_stream_factory.h"
#include <algorithm>
#include <limits>
#include <set>
#include <string>
#include <utility>
#include "absl/algorithm/container.h"
#include "absl/strings/match.h"
#include "api/field_trials_view.h"
#include "api/video/video_codec_constants.h"
#include "media/base/media_constants.h"
#include "media/base/video_adapter.h"
#include "modules/video_coding/codecs/vp9/svc_config.h"
#include "modules/video_coding/utility/simulcast_utility.h"
#include "rtc_base/experiments/min_video_bitrate_experiment.h"
#include "rtc_base/experiments/normalize_simulcast_size_experiment.h"
#include "rtc_base/logging.h"
#include "video/config/simulcast.h"
namespace cricket {
namespace {
FieldTrialsView;
const int kMinLayerSize = …;
int ScaleDownResolution(int resolution,
double scale_down_by,
int min_resolution) { … }
bool PowerOfTwo(int value) { … }
bool IsScaleFactorsPowerOfTwo(const webrtc::VideoEncoderConfig& config) { … }
bool IsTemporalLayersSupported(webrtc::VideoCodecType codec_type) { … }
size_t FindRequiredActiveLayers(
const webrtc::VideoEncoderConfig& encoder_config) { … }
static int GetMaxDefaultVideoBitrateKbps(int width,
int height,
bool is_screenshare) { … }
int GetDefaultMaxQp(webrtc::VideoCodecType codec_type) { … }
int NormalizeSimulcastSize(const FieldTrialsView& field_trials,
int size,
size_t simulcast_layers) { … }
void OverrideStreamSettings(
const webrtc::VideoEncoderConfig& encoder_config,
const absl::optional<webrtc::DataRate>& experimental_min_bitrate,
std::vector<webrtc::VideoStream>& layers) { … }
}
EncoderStreamFactory::EncoderStreamFactory(
const webrtc::VideoEncoder::EncoderInfo& encoder_info,
absl::optional<webrtc::VideoSourceRestrictions> restrictions)
: … { … }
std::vector<webrtc::VideoStream> EncoderStreamFactory::CreateEncoderStreams(
const FieldTrialsView& trials,
int frame_width,
int frame_height,
const webrtc::VideoEncoderConfig& encoder_config) { … }
std::vector<webrtc::VideoStream>
EncoderStreamFactory::CreateDefaultVideoStreams(
int width,
int height,
const webrtc::VideoEncoderConfig& encoder_config,
const absl::optional<webrtc::DataRate>& experimental_min_bitrate) const { … }
std::vector<webrtc::VideoStream>
EncoderStreamFactory::CreateSimulcastOrConferenceModeScreenshareStreams(
const FieldTrialsView& trials,
int width,
int height,
const webrtc::VideoEncoderConfig& encoder_config,
const absl::optional<webrtc::DataRate>& experimental_min_bitrate) const { … }
webrtc::Resolution
EncoderStreamFactory::GetLayerResolutionFromRequestedResolution(
int frame_width,
int frame_height,
webrtc::Resolution requested_resolution) const { … }
std::vector<webrtc::Resolution> EncoderStreamFactory::GetStreamResolutions(
const webrtc::FieldTrialsView& trials,
int width,
int height,
const webrtc::VideoEncoderConfig& encoder_config) const { … }
}