// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_MOJO_SERVICES_STABLE_VIDEO_DECODER_SERVICE_H_ #define MEDIA_MOJO_SERVICES_STABLE_VIDEO_DECODER_SERVICE_H_ #include "base/memory/raw_ptr.h" #include "base/sequence_checker.h" #include "base/thread_annotations.h" #include "base/unguessable_token.h" #include "build/chromeos_buildflags.h" #include "media/mojo/mojom/media_log.mojom.h" #include "media/mojo/mojom/stable/stable_video_decoder.mojom.h" #include "media/mojo/mojom/video_decoder.mojom.h" #include "media/mojo/services/media_mojo_export.h" #include "media/mojo/services/mojo_cdm_service_context.h" #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chromeos/components/cdm_factory_daemon/remote_cdm_context.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) namespace media { class MailboxFrameRegistry; // A StableVideoDecoderService serves as an adapter between the // stable::mojom::StableVideoDecoder interface and the mojom::VideoDecoder // interface. This allows us to provide hardware video decoding capabilities to // clients that may be using a different version of the // stable::mojom::StableVideoDecoder interface, e.g., LaCrOS. A // StableVideoDecoderService is intended to live in a video decoder process. // This process can host multiple StableVideoDecoderServices, but the assumption // is that they don't distrust each other. For example, they should all be // serving the same renderer process. // // TODO(b/195769334): a StableVideoDecoderService should probably be responsible // for checking incoming data to address issues that may arise due to the stable // nature of the stable::mojom::StableVideoDecoder interface. For example, // suppose the StableVideoDecoderService implements an older version of the // interface relative to the one used by the client. If the client Initialize()s // the StableVideoDecoderService with a VideoCodecProfile that's unsupported by // the older version of the interface, the StableVideoDecoderService should // reject that initialization. Conversely, the client of the // StableVideoDecoderService should also check incoming data due to similar // concerns. class MEDIA_MOJO_EXPORT StableVideoDecoderService : public stable::mojom::StableVideoDecoder, public stable::mojom::VideoFrameHandleReleaser, public mojom::VideoDecoderClient, public mojom::MediaLog { … }; } // namespace media #endif // MEDIA_MOJO_SERVICES_STABLE_VIDEO_DECODER_SERVICE_H_