LCOV - code coverage report
Current view: top level - dom/media/platforms/wrappers - MediaDataDecoderProxy.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 1 56 1.8 %
Date: 2017-07-14 16:53:18 Functions: 2 30 6.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:set ts=2 sw=2 sts=2 et cindent: */
       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             : 
       7             : #include "MediaDataDecoderProxy.h"
       8             : 
       9             : namespace mozilla {
      10             : 
      11             : RefPtr<MediaDataDecoder::InitPromise>
      12           0 : MediaDataDecoderProxy::Init()
      13             : {
      14           0 :   MOZ_ASSERT(!mIsShutdown);
      15             : 
      16           0 :   if (!mProxyThread) {
      17           0 :     return mProxyDecoder->Init();
      18             :   }
      19           0 :   RefPtr<MediaDataDecoderProxy> self = this;
      20             :   return InvokeAsync(mProxyThread, __func__,
      21           0 :                      [self, this]() { return mProxyDecoder->Init(); });
      22             : }
      23             : 
      24             : RefPtr<MediaDataDecoder::DecodePromise>
      25           0 : MediaDataDecoderProxy::Decode(MediaRawData* aSample)
      26             : {
      27           0 :   MOZ_ASSERT(!mIsShutdown);
      28             : 
      29           0 :   if (!mProxyThread) {
      30           0 :     return mProxyDecoder->Decode(aSample);
      31             :   }
      32           0 :   RefPtr<MediaDataDecoderProxy> self = this;
      33           0 :   RefPtr<MediaRawData> sample = aSample;
      34           0 :   return InvokeAsync(mProxyThread, __func__, [self, this, sample]() {
      35           0 :     return mProxyDecoder->Decode(sample);
      36           0 :   });
      37             : }
      38             : 
      39             : RefPtr<MediaDataDecoder::FlushPromise>
      40           0 : MediaDataDecoderProxy::Flush()
      41             : {
      42           0 :   MOZ_ASSERT(!mIsShutdown);
      43             : 
      44           0 :   if (!mProxyThread) {
      45           0 :     return mProxyDecoder->Flush();
      46             :   }
      47           0 :   RefPtr<MediaDataDecoderProxy> self = this;
      48             :   return InvokeAsync(mProxyThread, __func__,
      49           0 :                      [self, this]() { return mProxyDecoder->Flush(); });
      50             : }
      51             : 
      52             : RefPtr<MediaDataDecoder::DecodePromise>
      53           0 : MediaDataDecoderProxy::Drain()
      54             : {
      55           0 :   MOZ_ASSERT(!mIsShutdown);
      56             : 
      57           0 :   if (!mProxyThread) {
      58           0 :     return mProxyDecoder->Drain();
      59             :   }
      60           0 :   RefPtr<MediaDataDecoderProxy> self = this;
      61             :   return InvokeAsync(mProxyThread, __func__,
      62           0 :                      [self, this]() { return mProxyDecoder->Drain(); });
      63             : }
      64             : 
      65             : RefPtr<ShutdownPromise>
      66           0 : MediaDataDecoderProxy::Shutdown()
      67             : {
      68           0 :   MOZ_ASSERT(!mIsShutdown);
      69             : 
      70             : #if defined(DEBUG)
      71           0 :   mIsShutdown = true;
      72             : #endif
      73             : 
      74           0 :   if (!mProxyThread) {
      75           0 :     return mProxyDecoder->Shutdown();
      76             :   }
      77           0 :   RefPtr<MediaDataDecoderProxy> self = this;
      78             :   return InvokeAsync(mProxyThread, __func__,
      79           0 :                      [self, this]() { return mProxyDecoder->Shutdown(); });
      80             : }
      81             : 
      82             : const char*
      83           0 : MediaDataDecoderProxy::GetDescriptionName() const
      84             : {
      85           0 :   MOZ_ASSERT(!mIsShutdown);
      86             : 
      87           0 :   return mProxyDecoder->GetDescriptionName();
      88             : }
      89             : 
      90             : bool
      91           0 : MediaDataDecoderProxy::IsHardwareAccelerated(nsACString& aFailureReason) const
      92             : {
      93           0 :   MOZ_ASSERT(!mIsShutdown);
      94             : 
      95           0 :   return mProxyDecoder->IsHardwareAccelerated(aFailureReason);
      96             : }
      97             : 
      98             : void
      99           0 : MediaDataDecoderProxy::SetSeekThreshold(const media::TimeUnit& aTime)
     100             : {
     101           0 :   MOZ_ASSERT(!mIsShutdown);
     102             : 
     103           0 :   if (!mProxyThread) {
     104           0 :     mProxyDecoder->SetSeekThreshold(aTime);
     105           0 :     return;
     106             :   }
     107           0 :   RefPtr<MediaDataDecoderProxy> self = this;
     108           0 :   media::TimeUnit time = aTime;
     109           0 :   mProxyThread->Dispatch(NS_NewRunnableFunction(
     110             :     "MediaDataDecoderProxy::SetSeekThreshold",
     111           0 :     [self, time] { self->mProxyDecoder->SetSeekThreshold(time); }));
     112             : }
     113             : 
     114             : bool
     115           0 : MediaDataDecoderProxy::SupportDecoderRecycling() const
     116             : {
     117           0 :   MOZ_ASSERT(!mIsShutdown);
     118             : 
     119           0 :   return mProxyDecoder->SupportDecoderRecycling();
     120             : }
     121             : 
     122             : MediaDataDecoder::ConversionRequired
     123           0 : MediaDataDecoderProxy::NeedsConversion() const
     124             : {
     125           0 :   MOZ_ASSERT(!mIsShutdown);
     126             : 
     127           0 :   return mProxyDecoder->NeedsConversion();
     128             : }
     129             : 
     130           9 : } // namespace mozilla

Generated by: LCOV version 1.13