#include "media/mojo/services/mojo_video_encode_accelerator_service.h"
#include <memory>
#include <utility>
#include "base/logging.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "media/base/bitstream_buffer.h"
#include "media/base/limits.h"
#include "media/base/media_util.h"
#include "media/mojo/mojom/video_encoder_info.mojom.h"
#include "media/mojo/services/mojo_media_log.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "mojo/public/cpp/system/platform_handle.h"
namespace media {
void MojoVideoEncodeAcceleratorService::Create(
mojo::PendingReceiver<mojom::VideoEncodeAccelerator> receiver,
CreateAndInitializeVideoEncodeAcceleratorCallback create_vea_callback,
const gpu::GpuPreferences& gpu_preferences,
const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
const gpu::GPUInfo::GPUDevice& gpu_device) { … }
MojoVideoEncodeAcceleratorService::MojoVideoEncodeAcceleratorService(
CreateAndInitializeVideoEncodeAcceleratorCallback create_vea_callback,
const gpu::GpuPreferences& gpu_preferences,
const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
const gpu::GPUInfo::GPUDevice& gpu_device)
: … { … }
MojoVideoEncodeAcceleratorService::~MojoVideoEncodeAcceleratorService() { … }
void MojoVideoEncodeAcceleratorService::Initialize(
const media::VideoEncodeAccelerator::Config& config,
mojo::PendingAssociatedRemote<mojom::VideoEncodeAcceleratorClient> client,
mojo::PendingRemote<mojom::MediaLog> media_log,
InitializeCallback success_callback) { … }
void MojoVideoEncodeAcceleratorService::Encode(
const scoped_refptr<VideoFrame>& frame,
const media::VideoEncoder::EncodeOptions& options,
EncodeCallback callback) { … }
void MojoVideoEncodeAcceleratorService::UseOutputBitstreamBuffer(
int32_t bitstream_buffer_id,
base::UnsafeSharedMemoryRegion region) { … }
void MojoVideoEncodeAcceleratorService::
RequestEncodingParametersChangeWithLayers(
const media::VideoBitrateAllocation& bitrate_allocation,
uint32_t framerate,
const std::optional<gfx::Size>& size) { … }
void MojoVideoEncodeAcceleratorService::
RequestEncodingParametersChangeWithBitrate(
const media::Bitrate& bitrate,
uint32_t framerate,
const std::optional<gfx::Size>& size) { … }
void MojoVideoEncodeAcceleratorService::IsFlushSupported(
IsFlushSupportedCallback callback) { … }
void MojoVideoEncodeAcceleratorService::Flush(FlushCallback callback) { … }
void MojoVideoEncodeAcceleratorService::RequireBitstreamBuffers(
unsigned int input_count,
const gfx::Size& input_coded_size,
size_t output_buffer_size) { … }
void MojoVideoEncodeAcceleratorService::BitstreamBufferReady(
int32_t bitstream_buffer_id,
const media::BitstreamBufferMetadata& metadata) { … }
void MojoVideoEncodeAcceleratorService::NotifyErrorStatus(
const EncoderStatus& status) { … }
void MojoVideoEncodeAcceleratorService::NotifyEncoderInfoChange(
const ::media::VideoEncoderInfo& info) { … }
}