#include "media/mojo/clients/mojo_video_decoder.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/decoder_buffer.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_switches.h"
#include "media/base/overlay_info.h"
#include "media/base/supported_types.h"
#include "media/base/video_frame.h"
#include "media/media_buildflags.h"
#include "media/mojo/clients/mojo_media_log_service.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "media/video/gpu_video_accelerator_factories.h"
#include "media/video/video_decode_accelerator.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "mojo/public/cpp/bindings/shared_remote.h"
namespace media {
class MojoVideoFrameHandleReleaser
: public base::RefCountedThreadSafe<MojoVideoFrameHandleReleaser> { … };
MojoVideoDecoder::MojoVideoDecoder(
scoped_refptr<base::SequencedTaskRunner> task_runner,
GpuVideoAcceleratorFactories* gpu_factories,
MediaLog* media_log,
mojo::PendingRemote<mojom::VideoDecoder> pending_remote_decoder,
RequestOverlayInfoCB request_overlay_info_cb,
const gfx::ColorSpace& target_color_space)
: … { … }
MojoVideoDecoder::~MojoVideoDecoder() { … }
bool MojoVideoDecoder::IsPlatformDecoder() const { … }
bool MojoVideoDecoder::SupportsDecryption() const { … }
VideoDecoderType MojoVideoDecoder::GetDecoderType() const { … }
void MojoVideoDecoder::FailInit(InitCB init_cb, DecoderStatus err) { … }
void MojoVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool low_delay,
CdmContext* cdm_context,
InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& waiting_cb) { … }
void MojoVideoDecoder::InitializeRemoteDecoder(
const VideoDecoderConfig& config,
bool low_delay,
std::optional<base::UnguessableToken> cdm_id) { … }
void MojoVideoDecoder::OnInitializeDone(const DecoderStatus& status,
bool needs_bitstream_conversion,
int32_t max_decode_requests,
VideoDecoderType decoder_type) { … }
void MojoVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) { … }
void MojoVideoDecoder::OnVideoFrameDecoded(
const scoped_refptr<VideoFrame>& frame,
bool can_read_without_stalling,
const std::optional<base::UnguessableToken>& release_token) { … }
void MojoVideoDecoder::OnDecodeDone(uint64_t decode_id,
const DecoderStatus& status) { … }
void MojoVideoDecoder::Reset(base::OnceClosure reset_cb) { … }
void MojoVideoDecoder::OnResetDone() { … }
bool MojoVideoDecoder::NeedsBitstreamConversion() const { … }
bool MojoVideoDecoder::CanReadWithoutStalling() const { … }
int MojoVideoDecoder::GetMaxDecodeRequests() const { … }
void MojoVideoDecoder::InitAndBindRemoteDecoder(base::OnceClosure complete_cb) { … }
void MojoVideoDecoder::OnChannelTokenReady(
media::mojom::CommandBufferIdPtr command_buffer_id,
base::OnceClosure complete_cb,
const base::UnguessableToken& channel_token) { … }
void MojoVideoDecoder::InitAndConstructRemoteDecoder(
media::mojom::CommandBufferIdPtr command_buffer_id,
base::OnceClosure complete_cb) { … }
void MojoVideoDecoder::OnWaiting(WaitingReason reason) { … }
void MojoVideoDecoder::RequestOverlayInfo(bool restart_for_transitions) { … }
void MojoVideoDecoder::OnOverlayInfoChanged(const OverlayInfo& overlay_info) { … }
void MojoVideoDecoder::Stop() { … }
}