#include "test/fake_encoder.h"
#include <string.h>
#include <algorithm>
#include <cstdint>
#include <memory>
#include <string>
#include "api/environment/environment.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/video/video_content_type.h"
#include "modules/video_coding/codecs/h264/include/h264_globals.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "rtc_base/checks.h"
#include "system_wrappers/include/sleep.h"
namespace webrtc {
namespace test {
namespace {
const int kKeyframeSizeFactor = …;
const int kTemporalLayerRateFactor[4][4] = …;
void WriteCounter(unsigned char* payload, uint32_t counter) { … }
}
FakeEncoder::FakeEncoder(const Environment& env)
: … { … }
void FakeEncoder::SetFecControllerOverride(
FecControllerOverride* fec_controller_override) { … }
void FakeEncoder::SetMaxBitrate(int max_kbps) { … }
void FakeEncoder::SetQp(int qp) { … }
void FakeEncoder::SetImplementationName(absl::string_view implementation_name) { … }
int32_t FakeEncoder::InitEncode(const VideoCodec* config,
const Settings& settings) { … }
int32_t FakeEncoder::Encode(const VideoFrame& input_image,
const std::vector<VideoFrameType>* frame_types) { … }
CodecSpecificInfo FakeEncoder::EncodeHook(
EncodedImage& encoded_image,
rtc::scoped_refptr<EncodedImageBuffer> buffer) { … }
FakeEncoder::FrameInfo FakeEncoder::NextFrame(
const std::vector<VideoFrameType>* frame_types,
bool keyframe,
uint8_t num_simulcast_streams,
const VideoBitrateAllocation& target_bitrate,
SimulcastStream simulcast_streams[kMaxSimulcastStreams],
int framerate) { … }
int32_t FakeEncoder::RegisterEncodeCompleteCallback(
EncodedImageCallback* callback) { … }
int32_t FakeEncoder::Release() { … }
void FakeEncoder::SetRates(const RateControlParameters& parameters) { … }
void FakeEncoder::SetRatesLocked(const RateControlParameters& parameters) { … }
VideoEncoder::EncoderInfo FakeEncoder::GetEncoderInfo() const { … }
int FakeEncoder::GetConfiguredInputFramerate() const { … }
int FakeEncoder::GetNumInitializations() const { … }
const VideoCodec& FakeEncoder::config() const { … }
FakeH264Encoder::FakeH264Encoder(const Environment& env)
: … { … }
CodecSpecificInfo FakeH264Encoder::EncodeHook(
EncodedImage& encoded_image,
rtc::scoped_refptr<EncodedImageBuffer> buffer) { … }
DelayedEncoder::DelayedEncoder(const Environment& env, int delay_ms)
: … { … }
void DelayedEncoder::SetDelay(int delay_ms) { … }
int32_t DelayedEncoder::Encode(const VideoFrame& input_image,
const std::vector<VideoFrameType>* frame_types) { … }
MultithreadedFakeH264Encoder::MultithreadedFakeH264Encoder(
const Environment& env)
: … { … }
int32_t MultithreadedFakeH264Encoder::InitEncode(const VideoCodec* config,
const Settings& settings) { … }
int32_t MultithreadedFakeH264Encoder::Encode(
const VideoFrame& input_image,
const std::vector<VideoFrameType>* frame_types) { … }
int32_t MultithreadedFakeH264Encoder::EncodeCallback(
const VideoFrame& input_image,
const std::vector<VideoFrameType>* frame_types) { … }
int32_t MultithreadedFakeH264Encoder::Release() { … }
}
}