Bug 1286096 - Have MediaEngineDefaultVideoSource inherit from MediaEngineCameraVideoSource. r=padenot
authorJan-Ivar Bruaroey <jib@mozilla.com>
Mon, 11 Jul 2016 12:31:33 -0400
changeset 349150 ca07b7baf290eced567755bf903a3a7edab26c1e
parent 349149 8e0019ff663e368c44b63fe10453add7b9fb0782
child 349151 8a75cd08366e262e6fe6ffe871375de3332dc833
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1286096
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1286096 - Have MediaEngineDefaultVideoSource inherit from MediaEngineCameraVideoSource. r=padenot MozReview-Commit-ID: KxT4HRaGe9
dom/media/webrtc/MediaEngineCameraVideoSource.h
dom/media/webrtc/MediaEngineDefault.cpp
dom/media/webrtc/MediaEngineDefault.h
--- a/dom/media/webrtc/MediaEngineCameraVideoSource.h
+++ b/dom/media/webrtc/MediaEngineCameraVideoSource.h
@@ -20,29 +20,32 @@ bool operator == (const webrtc::CaptureC
                   const webrtc::CaptureCapability& b);
 bool operator != (const webrtc::CaptureCapability& a,
                   const webrtc::CaptureCapability& b);
 
 class MediaEngineCameraVideoSource : public MediaEngineVideoSource,
                                      protected MediaConstraintsHelper
 {
 public:
+  // Some subclasses use an index to track multiple instances.
   explicit MediaEngineCameraVideoSource(int aIndex,
                                         const char* aMonitorName = "Camera.Monitor")
     : MediaEngineVideoSource(kReleased)
     , mMonitor(aMonitorName)
     , mWidth(0)
     , mHeight(0)
     , mInitDone(false)
     , mHasDirectListeners(false)
     , mNrAllocations(0)
     , mCaptureIndex(aIndex)
     , mTrackID(0)
   {}
 
+  explicit MediaEngineCameraVideoSource(const char* aMonitorName = "Camera.Monitor")
+    : MediaEngineCameraVideoSource(0, aMonitorName) {}
 
   void GetName(nsAString& aName) const override;
   void GetUUID(nsACString& aUUID) const override;
   void SetDirectListeners(bool aHasListeners) override;
 
   bool IsFake() override
   {
     return false;
--- a/dom/media/webrtc/MediaEngineDefault.cpp
+++ b/dom/media/webrtc/MediaEngineDefault.cpp
@@ -38,17 +38,17 @@ static const int kFakeVideoTrackCount = 
 static const int kFakeAudioTrackCount = 3;
 
 NS_IMPL_ISUPPORTS(MediaEngineDefaultVideoSource, nsITimerCallback)
 /**
  * Default video source.
  */
 
 MediaEngineDefaultVideoSource::MediaEngineDefaultVideoSource()
-  : MediaEngineVideoSource(kReleased)
+  : MediaEngineCameraVideoSource("FakeVideo.Monitor")
   , mTimer(nullptr)
   , mMonitor("Fake video")
   , mCb(16), mCr(16)
 {
   mImageContainer =
     layers::LayerManager::CreateImageContainer(layers::ImageContainer::ASYNCHRONOUS);
 }
 
--- a/dom/media/webrtc/MediaEngineDefault.h
+++ b/dom/media/webrtc/MediaEngineDefault.h
@@ -13,33 +13,33 @@
 #include "nsComponentManagerUtils.h"
 #include "mozilla/Monitor.h"
 
 #include "VideoUtils.h"
 #include "MediaEngine.h"
 #include "VideoSegment.h"
 #include "AudioSegment.h"
 #include "StreamTracks.h"
+#include "MediaEngineCameraVideoSource.h"
 #include "MediaStreamGraph.h"
 #include "MediaTrackConstraints.h"
 
 namespace mozilla {
 
 namespace layers {
 class ImageContainer;
 } // namespace layers
 
 class MediaEngineDefault;
 
 /**
  * The default implementation of the MediaEngine interface.
  */
 class MediaEngineDefaultVideoSource : public nsITimerCallback,
-                                      public MediaEngineVideoSource,
-                                      private MediaConstraintsHelper
+                                      public MediaEngineCameraVideoSource
 {
 public:
   MediaEngineDefaultVideoSource();
 
   void Shutdown() override {};
 
   void GetName(nsAString&) const override;
   void GetUUID(nsACString&) const override;