#include "test/pc/e2e/analyzer/video/quality_analyzing_video_encoder.h"
#include <cmath>
#include <memory>
#include <utility>
#include "absl/strings/string_view.h"
#include "api/environment/environment.h"
#include "api/video/video_codec_type.h"
#include "api/video_codecs/video_encoder.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "modules/video_coding/svc/scalability_mode_util.h"
#include "rtc_base/logging.h"
namespace webrtc {
namespace webrtc_pc_e2e {
namespace {
EmulatedSFUConfigMap;
constexpr size_t kMaxFrameInPipelineCount = …;
constexpr double kNoMultiplier = …;
constexpr double kEps = …;
std::pair<uint32_t, uint32_t> GetMinMaxBitratesBps(const VideoCodec& codec,
size_t spatial_idx) { … }
}
QualityAnalyzingVideoEncoder::QualityAnalyzingVideoEncoder(
absl::string_view peer_name,
std::unique_ptr<VideoEncoder> delegate,
double bitrate_multiplier,
EmulatedSFUConfigMap stream_to_sfu_config,
EncodedImageDataInjector* injector,
VideoQualityAnalyzerInterface* analyzer)
: … { … }
QualityAnalyzingVideoEncoder::~QualityAnalyzingVideoEncoder() = default;
void QualityAnalyzingVideoEncoder::SetFecControllerOverride(
FecControllerOverride* fec_controller_override) { … }
int32_t QualityAnalyzingVideoEncoder::InitEncode(
const VideoCodec* codec_settings,
const Settings& settings) { … }
int32_t QualityAnalyzingVideoEncoder::RegisterEncodeCompleteCallback(
EncodedImageCallback* callback) { … }
int32_t QualityAnalyzingVideoEncoder::Release() { … }
int32_t QualityAnalyzingVideoEncoder::Encode(
const VideoFrame& frame,
const std::vector<VideoFrameType>* frame_types) { … }
void QualityAnalyzingVideoEncoder::SetRates(
const VideoEncoder::RateControlParameters& parameters) { … }
VideoEncoder::EncoderInfo QualityAnalyzingVideoEncoder::GetEncoderInfo() const { … }
EncodedImageCallback::Result QualityAnalyzingVideoEncoder::OnEncodedImage(
const EncodedImage& encoded_image,
const CodecSpecificInfo* codec_specific_info) { … }
void QualityAnalyzingVideoEncoder::OnDroppedFrame(
EncodedImageCallback::DropReason reason) { … }
bool QualityAnalyzingVideoEncoder::ShouldDiscard(
uint16_t frame_id,
const EncodedImage& encoded_image) { … }
QualityAnalyzingVideoEncoderFactory::QualityAnalyzingVideoEncoderFactory(
absl::string_view peer_name,
std::unique_ptr<VideoEncoderFactory> delegate,
double bitrate_multiplier,
EmulatedSFUConfigMap stream_to_sfu_config,
EncodedImageDataInjector* injector,
VideoQualityAnalyzerInterface* analyzer)
: … { … }
QualityAnalyzingVideoEncoderFactory::~QualityAnalyzingVideoEncoderFactory() =
default;
std::vector<SdpVideoFormat>
QualityAnalyzingVideoEncoderFactory::GetSupportedFormats() const { … }
VideoEncoderFactory::CodecSupport
QualityAnalyzingVideoEncoderFactory::QueryCodecSupport(
const SdpVideoFormat& format,
absl::optional<std::string> scalability_mode) const { … }
std::unique_ptr<VideoEncoder> QualityAnalyzingVideoEncoderFactory::Create(
const Environment& env,
const SdpVideoFormat& format) { … }
}
}