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

          Line data    Source code
       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             : 
       7             : #ifndef MediaDecoderReaderWrapper_h_
       8             : #define MediaDecoderReaderWrapper_h_
       9             : 
      10             : #include "mozilla/AbstractThread.h"
      11             : #include "mozilla/RefPtr.h"
      12             : #include "mozilla/Variant.h"
      13             : #include "nsISupportsImpl.h"
      14             : 
      15             : #include "MediaDecoderReader.h"
      16             : #include "MediaEventSource.h"
      17             : 
      18             : namespace mozilla {
      19             : 
      20             : /**
      21             :  * A wrapper around MediaDecoderReader to offset the timestamps of Audio/Video
      22             :  * samples by the start time to ensure MDSM can always assume zero start time.
      23             :  * It also adjusts the seek target passed to Seek() to ensure correct seek time
      24             :  * is passed to the underlying reader.
      25             :  */
      26             : class MediaDecoderReaderWrapper {
      27             :   typedef MediaDecoderReader::MetadataPromise MetadataPromise;
      28             :   typedef MediaDecoderReader::AudioDataPromise AudioDataPromise;
      29             :   typedef MediaDecoderReader::VideoDataPromise VideoDataPromise;
      30             :   typedef MediaDecoderReader::SeekPromise SeekPromise;
      31             :   typedef MediaDecoderReader::WaitForDataPromise WaitForDataPromise;
      32             :   typedef MediaDecoderReader::TrackSet TrackSet;
      33           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDecoderReaderWrapper);
      34             : 
      35             : public:
      36             :   MediaDecoderReaderWrapper(AbstractThread* aOwnerThread,
      37             :                             MediaDecoderReader* aReader);
      38             : 
      39             :   media::TimeUnit StartTime() const;
      40             :   RefPtr<MetadataPromise> ReadMetadata();
      41             : 
      42             :   RefPtr<AudioDataPromise> RequestAudioData();
      43             : 
      44             :   RefPtr<VideoDataPromise>
      45             :   RequestVideoData(const media::TimeUnit& aTimeThreshold);
      46             : 
      47             :   RefPtr<WaitForDataPromise> WaitForData(MediaData::Type aType);
      48             : 
      49             :   RefPtr<SeekPromise> Seek(const SeekTarget& aTarget);
      50             :   RefPtr<ShutdownPromise> Shutdown();
      51             : 
      52             :   void ReleaseResources();
      53             :   void ResetDecode(TrackSet aTracks);
      54             : 
      55           0 :   nsresult Init() { return mReader->Init(); }
      56           0 :   bool IsAsync() const { return mReader->IsAsync(); }
      57           0 :   bool UseBufferingHeuristics() const { return mReader->UseBufferingHeuristics(); }
      58             : 
      59           0 :   bool VideoIsHardwareAccelerated() const {
      60           0 :     return mReader->VideoIsHardwareAccelerated();
      61             :   }
      62           0 :   TimedMetadataEventSource& TimedMetadataEvent() {
      63           0 :     return mReader->TimedMetadataEvent();
      64             :   }
      65           0 :   MediaEventSource<void>& OnMediaNotSeekable() {
      66           0 :     return mReader->OnMediaNotSeekable();
      67             :   }
      68           0 :   size_t SizeOfVideoQueueInBytes() const {
      69           0 :     return mReader->SizeOfVideoQueueInBytes();
      70             :   }
      71           0 :   size_t SizeOfAudioQueueInBytes() const {
      72           0 :     return mReader->SizeOfAudioQueueInBytes();
      73             :   }
      74           0 :   size_t SizeOfAudioQueueInFrames() const {
      75           0 :     return mReader->SizeOfAudioQueueInFrames();
      76             :   }
      77           0 :   size_t SizeOfVideoQueueInFrames() const {
      78           0 :     return mReader->SizeOfVideoQueueInFrames();
      79             :   }
      80           0 :   void ReadUpdatedMetadata(MediaInfo* aInfo) {
      81           0 :     mReader->ReadUpdatedMetadata(aInfo);
      82           0 :   }
      83           0 :   AbstractCanonical<media::TimeIntervals>* CanonicalBuffered() {
      84           0 :     return mReader->CanonicalBuffered();
      85             :   }
      86             : 
      87           0 :   void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
      88             : 
      89             :   void SetVideoBlankDecode(bool aIsBlankDecode);
      90             : 
      91             :   void SetCanonicalDuration(
      92             :     AbstractCanonical<media::NullableTimeUnit>* aCanonical);
      93             : 
      94             : private:
      95             :   ~MediaDecoderReaderWrapper();
      96             :   RefPtr<MetadataPromise> OnMetadataRead(MetadataHolder&& aMetadata);
      97             :   RefPtr<MetadataPromise> OnMetadataNotRead(const MediaResult& aError);
      98             :   void UpdateDuration();
      99             : 
     100             :   const RefPtr<AbstractThread> mOwnerThread;
     101             :   const RefPtr<MediaDecoderReader> mReader;
     102             : 
     103             :   bool mShutdown = false;
     104             :   Maybe<media::TimeUnit> mStartTime;
     105             : 
     106             :   // State-watching manager.
     107             :   WatchManager<MediaDecoderReaderWrapper> mWatchManager;
     108             : 
     109             :   // Duration, mirrored from the state machine task queue.
     110             :   Mirror<media::NullableTimeUnit> mDuration;
     111             : };
     112             : 
     113             : } // namespace mozilla
     114             : 
     115             : #endif // MediaDecoderReaderWrapper_h_

Generated by: LCOV version 1.13