Bug 1307630 - Have videoTrack.getSettings() return settings for video, not audio, from source with both. r=jesup, a=ritu
authorJan-Ivar Bruaroey <jib@mozilla.com>
Tue, 04 Oct 2016 19:31:52 -0400
changeset 358221 388d917d5fddaade45e409a5927213e4ff023349
parent 358220 27f8698b0106290c46727dcef2ed00b86d7caa4a
child 358222 f3a77790b93580374dc955508b03623f71c228eb
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, ritu
bugs1307630
milestone51.0a2
Bug 1307630 - Have videoTrack.getSettings() return settings for video, not audio, from source with both. r=jesup, a=ritu MozReview-Commit-ID: LkJnBuf1Fl0
dom/media/MediaManager.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -352,23 +352,30 @@ public:
   bool CapturingBrowser()
   {
     MOZ_ASSERT(NS_IsMainThread());
     return mVideoDevice && !mStopped &&
            mVideoDevice->GetSource()->IsAvailable() &&
            mVideoDevice->GetMediaSource() == dom::MediaSourceEnum::Browser;
   }
 
-  void GetSettings(dom::MediaTrackSettings& aOutSettings)
+  void GetSettings(dom::MediaTrackSettings& aOutSettings, TrackID aTrackID)
   {
-    if (mVideoDevice) {
-      mVideoDevice->GetSource()->GetSettings(aOutSettings);
-    }
-    if (mAudioDevice) {
-      mAudioDevice->GetSource()->GetSettings(aOutSettings);
+    switch (aTrackID) {
+      case kVideoTrack:
+        if (mVideoDevice) {
+          mVideoDevice->GetSource()->GetSettings(aOutSettings);
+        }
+        break;
+
+      case kAudioTrack:
+        if (mAudioDevice) {
+          mAudioDevice->GetSource()->GetSettings(aOutSettings);
+        }
+        break;
     }
   }
 
   // implement in .cpp to avoid circular dependency with MediaOperationTask
   // Can be invoked from EITHER MainThread or MSG thread
   void Stop();
 
   void
@@ -1163,17 +1170,17 @@ public:
           }
           return mListener->ApplyConstraintsToTrack(aWindow, mTrackID, aConstraints);
         }
 
         void
         GetSettings(dom::MediaTrackSettings& aOutSettings) override
         {
           if (mListener) {
-            mListener->GetSettings(aOutSettings);
+            mListener->GetSettings(aOutSettings, mTrackID);
           }
         }
 
         void Stop() override
         {
           if (mListener) {
             mListener->StopTrack(mTrackID);
             mListener = nullptr;