LCOV - code coverage report
Current view: top level - dom/media/gmp - ChromiumCDMChild.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 7 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          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 ChromiumCDMChild_h_
       7             : #define ChromiumCDMChild_h_
       8             : 
       9             : #include "content_decryption_module.h"
      10             : #include "mozilla/gmp/PChromiumCDMChild.h"
      11             : #include "SimpleMap.h"
      12             : #include "WidevineVideoFrame.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace gmp {
      16             : 
      17             : class GMPContentChild;
      18             : 
      19             : class ChromiumCDMChild : public PChromiumCDMChild
      20             :                        , public cdm::Host_8
      21             : {
      22             : public:
      23           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ChromiumCDMChild);
      24             : 
      25             :   explicit ChromiumCDMChild(GMPContentChild* aPlugin);
      26             : 
      27             :   void Init(cdm::ContentDecryptionModule_8* aCDM);
      28             : 
      29             :   void TimerExpired(void* aContext);
      30             : 
      31             :   // cdm::Host_8
      32             :   cdm::Buffer* Allocate(uint32_t aCapacity) override;
      33             :   void SetTimer(int64_t aDelayMs, void* aContext) override;
      34             :   cdm::Time GetCurrentWallTime() override;
      35             :   void OnResolveNewSessionPromise(uint32_t aPromiseId,
      36             :                                   const char* aSessionId,
      37             :                                   uint32_t aSessionIdSize) override;
      38             :   void OnResolvePromise(uint32_t aPromiseId) override;
      39             :   void OnRejectPromise(uint32_t aPromiseId,
      40             :                        cdm::Error aError,
      41             :                        uint32_t aSystemCode,
      42             :                        const char* aErrorMessage,
      43             :                        uint32_t aErrorMessageSize) override;
      44             :   void OnSessionMessage(const char* aSessionId,
      45             :                         uint32_t aSessionIdSize,
      46             :                         cdm::MessageType aMessageType,
      47             :                         const char* aMessage,
      48             :                         uint32_t aMessageSize,
      49             :                         const char* aLegacyDestinationUrl,
      50             :                         uint32_t aLegacyDestinationUrlLength) override;
      51             :   void OnSessionKeysChange(const char* aSessionId,
      52             :                            uint32_t aSessionIdSize,
      53             :                            bool aHasAdditionalUsableKey,
      54             :                            const cdm::KeyInformation* aKeysInfo,
      55             :                            uint32_t aKeysInfoCount) override;
      56             :   void OnExpirationChange(const char* aSessionId,
      57             :                           uint32_t aSessionIdSize,
      58             :                           cdm::Time aNewExpiryTime) override;
      59             :   void OnSessionClosed(const char* aSessionId,
      60             :                        uint32_t aSessionIdSize) override;
      61             :   void OnLegacySessionError(const char* aSessionId,
      62             :                             uint32_t aSessionIdLength,
      63             :                             cdm::Error aError,
      64             :                             uint32_t aSystemCode,
      65             :                             const char* aErrorMessage,
      66             :                             uint32_t aErrorMessageLength) override;
      67           0 :   void SendPlatformChallenge(const char* aServiceId,
      68             :                              uint32_t aServiceIdSize,
      69             :                              const char* aChallenge,
      70           0 :                              uint32_t aChallengeSize) override {}
      71           0 :   void EnableOutputProtection(uint32_t aDesiredProtectionMask) override {}
      72           0 :   void QueryOutputProtectionStatus() override {}
      73           0 :   void OnDeferredInitializationDone(cdm::StreamType aStreamType,
      74           0 :                                     cdm::Status aDecoderStatus) override {}
      75             :   cdm::FileIO* CreateFileIO(cdm::FileIOClient* aClient) override;
      76             : 
      77             :   void GiveBuffer(ipc::Shmem&& aBuffer);
      78             : 
      79             : protected:
      80             :   ~ChromiumCDMChild();
      81             : 
      82             :   bool IsOnMessageLoopThread();
      83             : 
      84             :   ipc::IPCResult RecvGiveBuffer(ipc::Shmem&& aShmem) override;
      85             :   ipc::IPCResult RecvPurgeShmems() override;
      86             :   void PurgeShmems();
      87             :   ipc::IPCResult RecvInit(const bool& aAllowDistinctiveIdentifier,
      88             :                           const bool& aAllowPersistentState) override;
      89             :   ipc::IPCResult RecvSetServerCertificate(
      90             :     const uint32_t& aPromiseId,
      91             :     nsTArray<uint8_t>&& aServerCert) override;
      92             :   ipc::IPCResult RecvCreateSessionAndGenerateRequest(
      93             :     const uint32_t& aPromiseId,
      94             :     const uint32_t& aSessionType,
      95             :     const uint32_t& aInitDataType,
      96             :     nsTArray<uint8_t>&& aInitData) override;
      97             :   ipc::IPCResult RecvLoadSession(const uint32_t& aPromiseId,
      98             :                                  const uint32_t& aSessionType,
      99             :                                  const nsCString& aSessionId) override;
     100             :   ipc::IPCResult RecvUpdateSession(const uint32_t& aPromiseId,
     101             :                                    const nsCString& aSessionId,
     102             :                                    nsTArray<uint8_t>&& aResponse) override;
     103             :   ipc::IPCResult RecvCloseSession(const uint32_t& aPromiseId,
     104             :                                   const nsCString& aSessionId) override;
     105             :   ipc::IPCResult RecvRemoveSession(const uint32_t& aPromiseId,
     106             :                                    const nsCString& aSessionId) override;
     107             :   ipc::IPCResult RecvDecrypt(const uint32_t& aId,
     108             :                              const CDMInputBuffer& aBuffer) override;
     109             :   ipc::IPCResult RecvInitializeVideoDecoder(
     110             :     const CDMVideoDecoderConfig& aConfig) override;
     111             :   ipc::IPCResult RecvDeinitializeVideoDecoder() override;
     112             :   ipc::IPCResult RecvResetVideoDecoder() override;
     113             :   ipc::IPCResult RecvDecryptAndDecodeFrame(
     114             :     const CDMInputBuffer& aBuffer) override;
     115             :   ipc::IPCResult RecvDrain() override;
     116             :   ipc::IPCResult RecvDestroy() override;
     117             : 
     118             :   void ReturnOutput(WidevineVideoFrame& aFrame);
     119             :   bool HasShmemOfSize(size_t aSize) const;
     120             : 
     121             :   GMPContentChild* mPlugin = nullptr;
     122             :   cdm::ContentDecryptionModule_8* mCDM = nullptr;
     123             : 
     124             :   typedef SimpleMap<uint64_t> DurationMap;
     125             :   DurationMap mFrameDurations;
     126             :   nsTArray<uint32_t> mLoadSessionPromiseIds;
     127             : 
     128             :   cdm::Size mCodedSize;
     129             :   nsTArray<ipc::Shmem> mBuffers;
     130             : 
     131             :   bool mDecoderInitialized = false;
     132             :   bool mPersistentStateAllowed = false;
     133             : };
     134             : 
     135             : } // namespace gmp
     136             : } // namespace mozilla
     137             : 
     138             : #endif // ChromiumCDMChild_h_

Generated by: LCOV version 1.13