Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef GMPVideoDecoderChild_h_
7 : #define GMPVideoDecoderChild_h_
8 :
9 : #include "nsString.h"
10 : #include "mozilla/gmp/PGMPVideoDecoderChild.h"
11 : #include "gmp-video-decode.h"
12 : #include "GMPSharedMemManager.h"
13 : #include "GMPVideoHost.h"
14 : #include "mozilla/gmp/GMPTypes.h"
15 :
16 : namespace mozilla {
17 : namespace gmp {
18 :
19 : class GMPContentChild;
20 :
21 : class GMPVideoDecoderChild : public PGMPVideoDecoderChild,
22 : public GMPVideoDecoderCallback,
23 : public GMPSharedMemManager
24 : {
25 : public:
26 0 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPVideoDecoderChild);
27 :
28 : explicit GMPVideoDecoderChild(GMPContentChild* aPlugin);
29 :
30 : void Init(GMPVideoDecoder* aDecoder);
31 : GMPVideoHostImpl& Host();
32 :
33 : // GMPVideoDecoderCallback
34 : void Decoded(GMPVideoi420Frame* decodedFrame) override;
35 : void ReceivedDecodedReferenceFrame(const uint64_t pictureId) override;
36 : void ReceivedDecodedFrame(const uint64_t pictureId) override;
37 : void InputDataExhausted() override;
38 : void DrainComplete() override;
39 : void ResetComplete() override;
40 : void Error(GMPErr aError) override;
41 :
42 : // GMPSharedMemManager
43 : bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) override;
44 : void Dealloc(Shmem& aMem) override;
45 :
46 : private:
47 : virtual ~GMPVideoDecoderChild();
48 :
49 : // PGMPVideoDecoderChild
50 : mozilla::ipc::IPCResult RecvInitDecode(const GMPVideoCodec& aCodecSettings,
51 : InfallibleTArray<uint8_t>&& aCodecSpecific,
52 : const int32_t& aCoreCount) override;
53 : mozilla::ipc::IPCResult RecvDecode(const GMPVideoEncodedFrameData& aInputFrame,
54 : const bool& aMissingFrames,
55 : InfallibleTArray<uint8_t>&& aCodecSpecificInfo,
56 : const int64_t& aRenderTimeMs) override;
57 : mozilla::ipc::IPCResult RecvChildShmemForPool(Shmem&& aFrameBuffer) override;
58 : mozilla::ipc::IPCResult RecvReset() override;
59 : mozilla::ipc::IPCResult RecvDrain() override;
60 : mozilla::ipc::IPCResult RecvDecodingComplete() override;
61 :
62 : GMPContentChild* mPlugin;
63 : GMPVideoDecoder* mVideoDecoder;
64 : GMPVideoHostImpl mVideoHost;
65 :
66 : // Non-zero when a GMP is blocked spinning the IPC message loop while
67 : // waiting on an NeedShmem to complete.
68 : int mNeedShmemIntrCount;
69 : bool mPendingDecodeComplete;
70 : };
71 :
72 : } // namespace gmp
73 : } // namespace mozilla
74 :
75 : #endif // GMPVideoDecoderChild_h_
|