#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "remoting/codec/webrtc_video_encoder_av1.h"
#include <algorithm>
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/system/sys_info.h"
#include "remoting/base/cpu_utils.h"
#include "remoting/base/util.h"
#include "remoting/codec/utils.h"
#include "third_party/libaom/source/libaom/aom/aom_image.h"
#include "third_party/libaom/source/libaom/aom/aomcx.h"
#include "third_party/libyuv/include/libyuv/convert_from_argb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
namespace remoting {
namespace {
void DestroyAomCodecContext(aom_codec_ctx_t* codec_ctx) { … }
constexpr int kAv1MinimumTargetBitrateKbpsPerMegapixel = …;
constexpr int kAv1DefaultEncoderSpeed = …;
}
WebrtcVideoEncoderAV1::WebrtcVideoEncoderAV1()
: … { … }
WebrtcVideoEncoderAV1::~WebrtcVideoEncoderAV1() = default;
void WebrtcVideoEncoderAV1::SetLosslessColor(bool want_lossless) { … }
void WebrtcVideoEncoderAV1::SetEncoderSpeed(int encoder_speed) { … }
void WebrtcVideoEncoderAV1::SetUseActiveMap(bool use_active_map) { … }
bool WebrtcVideoEncoderAV1::InitializeCodec(const webrtc::DesktopSize& size) { … }
void WebrtcVideoEncoderAV1::PrepareImage(
const webrtc::DesktopFrame* frame,
webrtc::DesktopRegion& updated_region) { … }
void WebrtcVideoEncoderAV1::ConfigureCodecParams() { … }
void WebrtcVideoEncoderAV1::UpdateConfig(const FrameParams& params) { … }
void WebrtcVideoEncoderAV1::Encode(std::unique_ptr<webrtc::DesktopFrame> frame,
const FrameParams& params,
EncodeCallback done) { … }
}