#include "media/gpu/chromeos/oop_video_decoder.h"
#include "base/memory/ptr_util.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "build/chromeos_buildflags.h"
#include "chromeos/components/cdm_factory_daemon/stable_cdm_context_impl.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "media/base/format_utils.h"
#include "media/base/video_util.h"
#include "media/gpu/buffer_validation.h"
#include "media/gpu/chromeos/native_pixmap_frame_resource.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/macros.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#if BUILDFLAG(USE_VAAPI)
#include "media/gpu/vaapi/vaapi_wrapper.h"
#endif
namespace media {
namespace {
constexpr size_t kTimestampCacheSize = …;
scoped_refptr<FrameResource> MojoVideoFrameToFrameResource(
stable::mojom::VideoFramePtr mojo_frame) { … }
class OOPVideoDecoderSupportedConfigsManager { … };
}
std::unique_ptr<VideoDecoderMixin> OOPVideoDecoder::Create(
mojo::PendingRemote<stable::mojom::StableVideoDecoder>
pending_remote_decoder,
std::unique_ptr<media::MediaLog> media_log,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
base::WeakPtr<VideoDecoderMixin::Client> client) { … }
void OOPVideoDecoder::NotifySupportKnown(
mojo::PendingRemote<stable::mojom::StableVideoDecoder> oop_video_decoder,
base::OnceCallback<
void(mojo::PendingRemote<stable::mojom::StableVideoDecoder>)> cb) { … }
std::optional<SupportedVideoDecoderConfigs>
OOPVideoDecoder::GetSupportedConfigs() { … }
void OOPVideoDecoder::ResetGlobalStateForTesting() { … }
OOPVideoDecoder::OOPVideoDecoder(
std::unique_ptr<media::MediaLog> media_log,
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner,
base::WeakPtr<VideoDecoderMixin::Client> client,
mojo::PendingRemote<stable::mojom::StableVideoDecoder>
pending_remote_decoder)
: … { … }
OOPVideoDecoder::~OOPVideoDecoder() { … }
void OOPVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool low_delay,
CdmContext* cdm_context,
InitCB init_cb,
const PipelineOutputCB& output_cb,
const WaitingCB& waiting_cb) { … }
void OOPVideoDecoder::OnInitializeDone(const DecoderStatus& status,
bool needs_bitstream_conversion,
int32_t max_decode_requests,
VideoDecoderType decoder_type,
bool needs_transcryption) { … }
void OOPVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) { … }
void OOPVideoDecoder::OnDecodeDone(uint64_t decode_id,
bool is_flush_cb,
const DecoderStatus& status) { … }
void OOPVideoDecoder::DeferDecodeCallback(DecodeCB decode_cb,
const DecoderStatus& status) { … }
void OOPVideoDecoder::CallDeferredDecodeCallback(DecodeCB decode_cb,
const DecoderStatus& status) { … }
bool OOPVideoDecoder::HasPendingDecodeCallbacks() const { … }
void OOPVideoDecoder::Reset(base::OnceClosure reset_cb) { … }
void OOPVideoDecoder::OnResetDone() { … }
void OOPVideoDecoder::CallResetCallback() { … }
void OOPVideoDecoder::Stop() { … }
void OOPVideoDecoder::ReleaseVideoFrame(
const base::UnguessableToken& release_token) { … }
void OOPVideoDecoder::ApplyResolutionChange() { … }
bool OOPVideoDecoder::NeedsBitstreamConversion() const { … }
bool OOPVideoDecoder::CanReadWithoutStalling() const { … }
int OOPVideoDecoder::GetMaxDecodeRequests() const { … }
VideoDecoderType OOPVideoDecoder::GetDecoderType() const { … }
bool OOPVideoDecoder::IsPlatformDecoder() const { … }
bool OOPVideoDecoder::NeedsTranscryption() { … }
void OOPVideoDecoder::OnVideoFrameDecoded(
stable::mojom::VideoFramePtr frame,
bool can_read_without_stalling,
const base::UnguessableToken& release_token) { … }
void OOPVideoDecoder::OnWaiting(WaitingReason reason) { … }
void OOPVideoDecoder::AddLogRecord(const MediaLogRecord& event) { … }
FrameResource* OOPVideoDecoder::GetOriginalFrame(
gfx::GenericSharedMemoryId frame_id) { … }
}