#include "third_party/blink/renderer/modules/mediarecorder/vea_encoder.h"
#include <memory>
#include <string>
#include <utility>
#include "base/metrics/histogram_macros.h"
#include "base/numerics/checked_math.h"
#include "base/task/bind_post_task.h"
#include "base/trace_event/trace_event.h"
#include "media/base/bitrate.h"
#include "media/base/bitstream_buffer.h"
#include "media/base/media_util.h"
#include "media/base/video_encoder_metrics_provider.h"
#include "media/base/video_frame.h"
#include "media/video/gpu_video_accelerator_factories.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/libyuv/include/libyuv.h"
#include "ui/gfx/geometry/size.h"
kVEAEncoderMinResolutionHeight;
kVEAEncoderMinResolutionWidth;
namespace blink {
namespace {
const int kVEADefaultBitratePerPixel = …;
const int kVEAEncoderOutputBufferCount = …;
}
bool VEAEncoder::OutputBuffer::IsValid() { … }
VEAEncoder::VEAEncoder(
scoped_refptr<base::SequencedTaskRunner> encoding_task_runner,
const VideoTrackRecorder::OnEncodedVideoCB& on_encoded_video_cb,
const VideoTrackRecorder::OnErrorCB& on_error_cb,
media::Bitrate::Mode bitrate_mode,
uint32_t bits_per_second,
media::VideoCodecProfile codec,
std::optional<uint8_t> level,
const gfx::Size& size,
bool use_native_input,
bool is_screencast)
: … { … }
VEAEncoder::~VEAEncoder() { … }
void VEAEncoder::RequireBitstreamBuffers(unsigned int ,
const gfx::Size& input_coded_size,
size_t output_buffer_size) { … }
void VEAEncoder::BitstreamBufferReady(
int32_t bitstream_buffer_id,
const media::BitstreamBufferMetadata& metadata) { … }
void VEAEncoder::NotifyErrorStatus(const media::EncoderStatus& status) { … }
void VEAEncoder::UseOutputBitstreamBufferId(int32_t bitstream_buffer_id) { … }
void VEAEncoder::FrameFinished(
std::unique_ptr<base::MappedReadOnlyRegion> shm) { … }
void VEAEncoder::EncodeFrame(scoped_refptr<media::VideoFrame> frame,
base::TimeTicks capture_timestamp,
bool request_keyframe) { … }
void VEAEncoder::Initialize() { … }
void VEAEncoder::ConfigureEncoder(const gfx::Size& size,
bool use_native_input) { … }
}