no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / media / ipc / RemoteVideoDecoder.h
blob160d5cc4ba6d14e0e782949a7917e3eadf6509d9
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef include_dom_media_ipc_RemoteVideoDecoderChild_h
7 #define include_dom_media_ipc_RemoteVideoDecoderChild_h
8 #include "RemoteDecoderChild.h"
9 #include "RemoteDecoderManagerChild.h"
10 #include "RemoteDecoderParent.h"
12 namespace mozilla::layers {
13 class BufferRecycleBin;
14 } // namespace mozilla::layers
16 namespace mozilla {
18 class KnowsCompositorVideo : public layers::KnowsCompositor {
19 public:
20 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(KnowsCompositorVideo, override)
22 layers::TextureForwarder* GetTextureForwarder() override;
23 layers::LayersIPCActor* GetLayersIPCActor() override;
25 static already_AddRefed<KnowsCompositorVideo> TryCreateForIdentifier(
26 const layers::TextureFactoryIdentifier& aIdentifier);
28 private:
29 KnowsCompositorVideo() = default;
30 virtual ~KnowsCompositorVideo() = default;
33 using mozilla::ipc::IPCResult;
35 class RemoteVideoDecoderChild : public RemoteDecoderChild {
36 public:
37 explicit RemoteVideoDecoderChild(RemoteDecodeIn aLocation);
39 MOZ_IS_CLASS_INIT MediaResult
40 InitIPDL(const VideoInfo& aVideoInfo, float aFramerate,
41 const CreateDecoderParams::OptionSet& aOptions,
42 mozilla::Maybe<layers::TextureFactoryIdentifier> aIdentifier,
43 const Maybe<uint64_t>& aMediaEngineId,
44 const Maybe<TrackingId>& aTrackingId);
46 MediaResult ProcessOutput(DecodedOutputIPDL&& aDecodedData) override;
48 private:
49 RefPtr<mozilla::layers::BufferRecycleBin> mBufferRecycleBin;
52 class RemoteVideoDecoderParent final : public RemoteDecoderParent {
53 public:
54 RemoteVideoDecoderParent(
55 RemoteDecoderManagerParent* aParent, const VideoInfo& aVideoInfo,
56 float aFramerate, const CreateDecoderParams::OptionSet& aOptions,
57 const Maybe<layers::TextureFactoryIdentifier>& aIdentifier,
58 nsISerialEventTarget* aManagerThread, TaskQueue* aDecodeTaskQueue,
59 const Maybe<uint64_t>& aMediaEngineId, Maybe<TrackingId> aTrackingId);
61 protected:
62 IPCResult RecvConstruct(ConstructResolver&& aResolver) override;
64 MediaResult ProcessDecodedData(MediaDataDecoder::DecodedData&& aData,
65 DecodedOutputIPDL& aDecodedData) override;
67 private:
68 // Can only be accessed from the manager thread
69 // Note: we can't keep a reference to the original VideoInfo here
70 // because unlike in typical MediaDataDecoder situations, we're being
71 // passed a deserialized VideoInfo from RecvPRemoteDecoderConstructor
72 // which is destroyed when RecvPRemoteDecoderConstructor returns.
73 const VideoInfo mVideoInfo;
74 const float mFramerate;
75 RefPtr<KnowsCompositorVideo> mKnowsCompositor;
78 } // namespace mozilla
80 #endif // include_dom_media_ipc_RemoteVideoDecoderChild_h