Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=99: */
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_ipc_VideoDecoderParent_h
7 : #define include_dom_ipc_VideoDecoderParent_h
8 :
9 : #include "ImageContainer.h"
10 : #include "MediaData.h"
11 : #include "PlatformDecoderModule.h"
12 : #include "VideoDecoderManagerParent.h"
13 : #include "mozilla/MozPromise.h"
14 : #include "mozilla/dom/PVideoDecoderParent.h"
15 : #include "mozilla/layers/TextureForwarder.h"
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : class KnowsCompositorVideo;
21 :
22 : class VideoDecoderParent final : public PVideoDecoderParent
23 : {
24 : public:
25 : // We refcount this class since the task queue can have runnables
26 : // that reference us.
27 0 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoDecoderParent)
28 :
29 : VideoDecoderParent(VideoDecoderManagerParent* aParent,
30 : const VideoInfo& aVideoInfo,
31 : const layers::TextureFactoryIdentifier& aIdentifier,
32 : TaskQueue* aManagerTaskQueue,
33 : TaskQueue* aDecodeTaskQueue,
34 : bool* aSuccess);
35 :
36 : void Destroy();
37 :
38 : // PVideoDecoderParent
39 : mozilla::ipc::IPCResult RecvInit() override;
40 : mozilla::ipc::IPCResult RecvInput(const MediaRawDataIPDL& aData) override;
41 : mozilla::ipc::IPCResult RecvFlush() override;
42 : mozilla::ipc::IPCResult RecvDrain() override;
43 : mozilla::ipc::IPCResult RecvShutdown() override;
44 : mozilla::ipc::IPCResult RecvSetSeekThreshold(const int64_t& aTime) override;
45 :
46 : void ActorDestroy(ActorDestroyReason aWhy) override;
47 :
48 : private:
49 : bool OnManagerThread();
50 : void Error(const MediaResult& aError);
51 :
52 : ~VideoDecoderParent();
53 : void ProcessDecodedData(const MediaDataDecoder::DecodedData& aData);
54 :
55 : RefPtr<VideoDecoderManagerParent> mParent;
56 : RefPtr<VideoDecoderParent> mIPDLSelfRef;
57 : RefPtr<TaskQueue> mManagerTaskQueue;
58 : RefPtr<TaskQueue> mDecodeTaskQueue;
59 : RefPtr<MediaDataDecoder> mDecoder;
60 : RefPtr<KnowsCompositorVideo> mKnowsCompositor;
61 :
62 : // Can only be accessed from the manager thread
63 : bool mDestroyed;
64 : };
65 :
66 : } // namespace dom
67 : } // namespace mozilla
68 :
69 : #endif // include_dom_ipc_VideoDecoderParent_h
|