#include "third_party/blink/renderer/modules/mediarecorder/media_recorder_encoder_wrapper.h"
#include "base/containers/contains.h"
#include "base/numerics/safe_conversions.h"
#include "media/base/video_encoder_metrics_provider.h"
#include "media/base/video_frame.h"
#include "media/media_buildflags.h"
#include "media/video/alpha_video_encoder_wrapper.h"
#include "media/video/gpu_video_accelerator_factories.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
namespace blink {
MediaRecorderEncoderWrapper::EncodeTask::EncodeTask(
scoped_refptr<media::VideoFrame> frame,
base::TimeTicks capture_timestamp,
bool request_keyframe)
: … { … }
MediaRecorderEncoderWrapper::EncodeTask::~EncodeTask() = default;
MediaRecorderEncoderWrapper::VideoParamsAndTimestamp::VideoParamsAndTimestamp(
const media::Muxer::VideoParameters& params,
base::TimeTicks timestamp)
: … { … }
MediaRecorderEncoderWrapper::VideoParamsAndTimestamp::
~VideoParamsAndTimestamp() = default;
MediaRecorderEncoderWrapper::MediaRecorderEncoderWrapper(
scoped_refptr<base::SequencedTaskRunner> encoding_task_runner,
media::VideoCodecProfile profile,
uint32_t bits_per_second,
bool is_screencast,
media::GpuVideoAcceleratorFactories* gpu_factories,
CreateEncoderCB create_encoder_cb,
VideoTrackRecorder::OnEncodedVideoCB on_encoded_video_cb,
OnErrorCB on_error_cb)
: … { … }
MediaRecorderEncoderWrapper::~MediaRecorderEncoderWrapper() { … }
bool MediaRecorderEncoderWrapper::CanEncodeAlphaChannel() const { … }
bool MediaRecorderEncoderWrapper::IsScreenContentEncodingForTesting() const { … }
void MediaRecorderEncoderWrapper::EnterErrorState(
const media::EncoderStatus& status) { … }
void MediaRecorderEncoderWrapper::Reconfigure(const gfx::Size& frame_size,
bool encode_alpha) { … }
void MediaRecorderEncoderWrapper::CreateAndInitialize(
const gfx::Size& frame_size,
bool encode_alpha,
media::EncoderStatus status) { … }
void MediaRecorderEncoderWrapper::InitializeDone(media::EncoderStatus status) { … }
void MediaRecorderEncoderWrapper::EncodeFrame(
scoped_refptr<media::VideoFrame> frame,
base::TimeTicks capture_timestamp,
bool request_keyframe) { … }
void MediaRecorderEncoderWrapper::EncodePendingTasks() { … }
void MediaRecorderEncoderWrapper::EncodeDone(media::EncoderStatus status) { … }
void MediaRecorderEncoderWrapper::OutputEncodeData(
media::VideoEncoderOutput output,
std::optional<media::VideoEncoder::CodecDescription> description) { … }
}