LCOV - code coverage report
Current view: top level - dom/media - Benchmark.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             : /* 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             : #ifndef MOZILLA_BENCHMARK_H
       8             : #define MOZILLA_BENCHMARK_H
       9             : 
      10             : #include "MediaDataDemuxer.h"
      11             : #include "PlatformDecoderModule.h"
      12             : #include "QueueObject.h"
      13             : #include "mozilla/Maybe.h"
      14             : #include "mozilla/RefPtr.h"
      15             : #include "mozilla/TimeStamp.h"
      16             : #include "nsCOMPtr.h"
      17             : 
      18             : namespace mozilla {
      19             : 
      20             : class TaskQueue;
      21             : class Benchmark;
      22             : 
      23           0 : class BenchmarkPlayback : public QueueObject
      24             : {
      25             :   friend class Benchmark;
      26             :   BenchmarkPlayback(Benchmark* aMainThreadState, MediaDataDemuxer* aDemuxer);
      27             :   void DemuxSamples();
      28             :   void DemuxNextSample();
      29             :   void MainThreadShutdown();
      30             :   void InitDecoder(TrackInfo&& aInfo);
      31             : 
      32             :   void Output(const MediaDataDecoder::DecodedData& aResults);
      33             :   void InputExhausted();
      34             : 
      35             :   Atomic<Benchmark*> mMainThreadState;
      36             : 
      37             :   RefPtr<TaskQueue> mDecoderTaskQueue;
      38             :   RefPtr<MediaDataDecoder> mDecoder;
      39             : 
      40             :   // Object only accessed on Thread()
      41             :   RefPtr<MediaDataDemuxer> mDemuxer;
      42             :   RefPtr<MediaTrackDemuxer> mTrackDemuxer;
      43             :   nsTArray<RefPtr<MediaRawData>> mSamples;
      44             :   size_t mSampleIndex;
      45             :   Maybe<TimeStamp> mDecodeStartTime;
      46             :   uint32_t mFrameCount;
      47             :   bool mFinished;
      48             :   bool mDrained;
      49             : };
      50             : 
      51             : // Init() must have been called at least once prior on the
      52             : // main thread.
      53             : class Benchmark : public QueueObject
      54             : {
      55             : public:
      56           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Benchmark)
      57             : 
      58           0 :   struct Parameters
      59             :   {
      60             :     Parameters()
      61             :       : mFramesToMeasure(-1)
      62             :       , mStartupFrame(1)
      63             :       , mTimeout(TimeDuration::Forever())
      64             :     {
      65             :     }
      66             : 
      67           0 :     Parameters(int32_t aFramesToMeasure,
      68             :                uint32_t aStartupFrame,
      69             :                int32_t aStopAtFrame,
      70             :                const TimeDuration& aTimeout)
      71           0 :       : mFramesToMeasure(aFramesToMeasure)
      72             :       , mStartupFrame(aStartupFrame)
      73             :       , mStopAtFrame(Some(aStopAtFrame))
      74           0 :       , mTimeout(aTimeout)
      75             :     {
      76           0 :     }
      77             : 
      78             :     const int32_t mFramesToMeasure;
      79             :     const uint32_t mStartupFrame;
      80             :     const Maybe<int32_t> mStopAtFrame;
      81             :     const TimeDuration mTimeout;
      82             :   };
      83             : 
      84             :   typedef MozPromise<uint32_t, bool, /* IsExclusive = */ true> BenchmarkPromise;
      85             : 
      86             :   explicit Benchmark(MediaDataDemuxer* aDemuxer,
      87             :                      const Parameters& aParameters = Parameters());
      88             :   RefPtr<BenchmarkPromise> Run();
      89             : 
      90             :   static void Init();
      91             : 
      92             : private:
      93             :   friend class BenchmarkPlayback;
      94             :   virtual ~Benchmark();
      95             :   void ReturnResult(uint32_t aDecodeFps);
      96             :   void Dispose();
      97             :   const Parameters mParameters;
      98             :   RefPtr<Benchmark> mKeepAliveUntilComplete;
      99             :   BenchmarkPlayback mPlaybackState;
     100             :   MozPromiseHolder<BenchmarkPromise> mPromise;
     101             : };
     102             : 
     103             : class VP9Benchmark
     104             : {
     105             : public:
     106             :   static bool IsVP9DecodeFast();
     107             :   static const char* sBenchmarkFpsPref;
     108             :   static const char* sBenchmarkFpsVersionCheck;
     109             :   static const uint32_t sBenchmarkVersionID;
     110             :   static bool sHasRunTest;
     111             : };
     112             : }
     113             : 
     114             : #endif

Generated by: LCOV version 1.13