LCOV - code coverage report
Current view: top level - dom/media/systemservices - VideoEngine.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 12 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 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 sw=2 ts=8 et ft=cpp : */
       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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_VideoEngine_h
       8             : #define mozilla_VideoEngine_h
       9             : 
      10             : #include "MediaEngine.h"
      11             : #include "VideoFrameUtils.h"
      12             : #include "mozilla/media/MediaUtils.h"
      13             : #include "webrtc/modules/video_capture/video_capture_impl.h"
      14             : #include "webrtc/modules/video_capture/video_capture_defines.h"
      15             : #include "webrtc/modules/video_capture/video_capture_factory.h"
      16             : #include "webrtc/video_engine/desktop_capture_impl.h"
      17             : #include <memory>
      18             : #include <functional>
      19             : 
      20             : namespace mozilla {
      21             : namespace camera {
      22             : 
      23             : // Historically the video engine was part of webrtc
      24             : // it was removed (and reimplemented in Talk)
      25             : class VideoEngine
      26             : {
      27             : private:
      28           0 :   virtual ~VideoEngine (){};
      29             : 
      30             : public:
      31             :   VideoEngine (){};
      32           0 :   NS_INLINE_DECL_REFCOUNTING(VideoEngine)
      33             : 
      34             :   static RefPtr<VideoEngine> Create(UniquePtr<const webrtc::Config>&& aConfig);
      35             : #if defined(ANDROID)
      36             :   static int SetAndroidObjects(JavaVM* javaVM);
      37             : #endif
      38             :   void CreateVideoCapture(int32_t& id, const char* deviceUniqueIdUTF8);
      39             : 
      40             :   int ReleaseVideoCapture(const int32_t id);
      41             : 
      42             :   // VideoEngine is responsible for any cleanup in its modules
      43           0 :   static void Delete(VideoEngine * engine) { }
      44             : 
      45             :   /** Returns or creates a new new DeviceInfo.
      46             :   *   It is cached to prevent repeated lengthy polling for "realness"
      47             :   *   of the hardware devices.  This could be handled in a more elegant
      48             :   *   way in the future.
      49             :   *   @return on failure the shared_ptr will be null, otherwise it will contain a DeviceInfo.
      50             :   *   @see bug 1305212 https://bugzilla.mozilla.org/show_bug.cgi?id=1305212
      51             :   */
      52             :   std::shared_ptr<webrtc::VideoCaptureModule::DeviceInfo> GetOrCreateVideoCaptureDeviceInfo();
      53             : 
      54             :   const UniquePtr<const webrtc::Config>& GetConfiguration();
      55             : 
      56           0 :   void Startup() {
      57           0 :     mIsRunning = true;
      58           0 :   }
      59             : 
      60           0 :   void Shutdown() {
      61           0 :     mIsRunning = false;
      62           0 :   }
      63             : 
      64           0 :   bool IsRunning() const {
      65           0 :     return mIsRunning;
      66             :   }
      67             : 
      68           0 :   class CaptureEntry {
      69             :   public:
      70             :     CaptureEntry(int32_t aCapnum,
      71             :                  rtc::scoped_refptr<webrtc::VideoCaptureModule> aCapture);
      72             :     int32_t Capnum() const;
      73             :     rtc::scoped_refptr<webrtc::VideoCaptureModule> VideoCapture();
      74             :   private:
      75             :     int32_t mCapnum;
      76             :     rtc::scoped_refptr<webrtc::VideoCaptureModule> mVideoCaptureModule;
      77             :     friend class VideoEngine;
      78             :   };
      79             : 
      80             :   // Returns true iff an entry for capnum exists
      81             :   bool WithEntry(const int32_t entryCapnum, const std::function<void(CaptureEntry &entry)>&& fn);
      82             : 
      83             : private:
      84             :   explicit VideoEngine(UniquePtr<const webrtc::Config>&& aConfig);
      85             :   bool mIsRunning;
      86             :   int32_t mId;
      87             :   webrtc::CaptureDeviceInfo mCaptureDevInfo;
      88             :   std::shared_ptr<webrtc::VideoCaptureModule::DeviceInfo> mDeviceInfo;
      89             :   UniquePtr<const webrtc::Config> mConfig;
      90             :   std::map<int32_t, CaptureEntry> mCaps;
      91             : 
      92             :   int32_t GenerateId();
      93             :   static int32_t sId;
      94             : };
      95             : }
      96             : }
      97             : #endif

Generated by: LCOV version 1.13