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

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       3             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #include "nsIDOMEventListener.h"
       6             : #include "MediaEngine.h"
       7             : #include "ImageContainer.h"
       8             : #include "nsITimer.h"
       9             : #include "mozilla/Monitor.h"
      10             : #include "mozilla/UniquePtr.h"
      11             : #include "nsITabSource.h"
      12             : 
      13             : namespace mozilla {
      14             : 
      15             : class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventListener, nsITimerCallback {
      16             :   public:
      17             :     NS_DECL_THREADSAFE_ISUPPORTS
      18             :     NS_DECL_NSIDOMEVENTLISTENER
      19             :     NS_DECL_NSITIMERCALLBACK
      20             :     MediaEngineTabVideoSource();
      21             : 
      22             :     void GetName(nsAString&) const override;
      23             :     void GetUUID(nsACString&) const override;
      24             : 
      25           0 :     bool GetScary() const override {
      26           0 :       return true;
      27             :     }
      28             : 
      29             :     nsresult Allocate(const dom::MediaTrackConstraints &,
      30             :                       const mozilla::MediaEnginePrefs&,
      31             :                       const nsString& aDeviceId,
      32             :                       const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
      33             :                       AllocationHandle** aOutHandle,
      34             :                       const char** aOutBadConstraint) override;
      35             :     nsresult Deallocate(AllocationHandle* aHandle) override;
      36             :     nsresult Start(mozilla::SourceMediaStream*, mozilla::TrackID, const mozilla::PrincipalHandle&) override;
      37           0 :     void SetDirectListeners(bool aHasDirectListeners) override {};
      38             :     void NotifyPull(mozilla::MediaStreamGraph*, mozilla::SourceMediaStream*, mozilla::TrackID, mozilla::StreamTime, const mozilla::PrincipalHandle& aPrincipalHandle) override;
      39             :     nsresult Stop(mozilla::SourceMediaStream*, mozilla::TrackID) override;
      40             :     nsresult Restart(AllocationHandle* aHandle,
      41             :                      const dom::MediaTrackConstraints& aConstraints,
      42             :                      const mozilla::MediaEnginePrefs& aPrefs,
      43             :                      const nsString& aDeviceId,
      44             :                      const char** aOutBadConstraint) override;
      45             :     bool IsFake() override;
      46           0 :     dom::MediaSourceEnum GetMediaSource() const override {
      47           0 :       return dom::MediaSourceEnum::Browser;
      48             :     }
      49           0 :     uint32_t GetBestFitnessDistance(
      50             :       const nsTArray<const NormalizedConstraintSet*>& aConstraintSets,
      51             :       const nsString& aDeviceId) const override
      52             :     {
      53           0 :       return 0;
      54             :     }
      55             : 
      56           0 :     nsresult TakePhoto(MediaEnginePhotoCallback* aCallback) override
      57             :     {
      58           0 :       return NS_ERROR_NOT_IMPLEMENTED;
      59             :     }
      60             : 
      61             :     void Draw();
      62             : 
      63           0 :     class StartRunnable : public Runnable {
      64             :     public:
      65           0 :       explicit StartRunnable(MediaEngineTabVideoSource *videoSource)
      66           0 :         : Runnable("MediaEngineTabVideoSource::StartRunnable")
      67           0 :         , mVideoSource(videoSource)
      68           0 :       {}
      69             :       NS_IMETHOD Run();
      70             :       RefPtr<MediaEngineTabVideoSource> mVideoSource;
      71             :     };
      72             : 
      73           0 :     class StopRunnable : public Runnable {
      74             :     public:
      75           0 :       explicit StopRunnable(MediaEngineTabVideoSource *videoSource)
      76           0 :         : Runnable("MediaEngineTabVideoSource::StopRunnable")
      77           0 :         , mVideoSource(videoSource)
      78           0 :       {}
      79             :       NS_IMETHOD Run();
      80             :       RefPtr<MediaEngineTabVideoSource> mVideoSource;
      81             :     };
      82             : 
      83           0 :     class InitRunnable : public Runnable {
      84             :     public:
      85           0 :       explicit InitRunnable(MediaEngineTabVideoSource *videoSource)
      86           0 :         : Runnable("MediaEngineTabVideoSource::InitRunnable")
      87           0 :         , mVideoSource(videoSource)
      88           0 :       {}
      89             :       NS_IMETHOD Run();
      90             :       RefPtr<MediaEngineTabVideoSource> mVideoSource;
      91             :     };
      92             : 
      93           0 :     class DestroyRunnable : public Runnable {
      94             :     public:
      95           0 :       explicit DestroyRunnable(MediaEngineTabVideoSource* videoSource)
      96           0 :         : Runnable("MediaEngineTabVideoSource::DestroyRunnable")
      97           0 :         , mVideoSource(videoSource)
      98           0 :       {}
      99             :       NS_IMETHOD Run();
     100             :       RefPtr<MediaEngineTabVideoSource> mVideoSource;
     101             :     };
     102             : 
     103             : protected:
     104           0 :     ~MediaEngineTabVideoSource() {}
     105             : 
     106             : private:
     107             :     int32_t mBufWidthMax;
     108             :     int32_t mBufHeightMax;
     109             :     int64_t mWindowId;
     110             :     bool mScrollWithPage;
     111             :     int32_t mViewportOffsetX;
     112             :     int32_t mViewportOffsetY;
     113             :     int32_t mViewportWidth;
     114             :     int32_t mViewportHeight;
     115             :     int32_t mTimePerFrame;
     116             :     UniquePtr<unsigned char[]> mData;
     117             :     size_t mDataSize;
     118             :     nsCOMPtr<nsPIDOMWindowOuter> mWindow;
     119             :     // If this is set, we will run despite mWindow == nullptr.
     120             :     bool mBlackedoutWindow;
     121             :     RefPtr<layers::SourceSurfaceImage> mImage;
     122             :     nsCOMPtr<nsITimer> mTimer;
     123             :     Monitor mMonitor;
     124             :     nsCOMPtr<nsITabSource> mTabSource;
     125             :   };
     126             : }

Generated by: LCOV version 1.13