Backed out changeset 6f3e405706ef (bug 1213517)
authorIris Hsiao <ihsiao@mozilla.com>
Mon, 18 Jul 2016 15:39:06 +0800
changeset 330343 a2b508faaa8988be0cf23f2a9e1c6253464c3d06
parent 330342 5890c3d8ac67eec31cc4b2f63a9f42ceac15beb7
child 330344 b97a43e6a167bf898b6f05f348884c33472b6e56
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1213517
milestone50.0a1
backs out6f3e405706ef093ed6cf04271d14448799c8213e
Backed out changeset 6f3e405706ef (bug 1213517)
dom/media/webrtc/MediaTrackConstraints.cpp
dom/media/webrtc/MediaTrackConstraints.h
--- a/dom/media/webrtc/MediaTrackConstraints.cpp
+++ b/dom/media/webrtc/MediaTrackConstraints.cpp
@@ -42,26 +42,25 @@ NormalizedConstraintSet::Range<bool>::Me
   Intersect(aOther);
 
   // To avoid "unsafe use of type 'bool'", we keep counter in mMergeDenominator
   uint32_t counter = mMergeDenominator >> 16;
   uint32_t denominator = mMergeDenominator & 0xffff;
 
   if (aOther.mIdeal.isSome()) {
     if (mIdeal.isNothing()) {
-      mIdeal.emplace(aOther.Get(false));
-      counter = aOther.Get(false);
+      mIdeal.emplace(aOther.mIdeal.value());
+      counter = aOther.mIdeal.value();
       denominator = 1;
     } else {
       if (!denominator) {
-        counter = Get(false);
-        denominator = 1;
+        counter = mIdeal.value();
       }
-      counter += aOther.Get(false);
-      denominator++;
+      counter += aOther.mIdeal.value();
+      denominator = std::max(2U, denominator + 1);
     }
   }
   mMergeDenominator = ((counter & 0xffff) << 16) + (denominator & 0xffff);
   return true;
 }
 
 template<>
 void
--- a/dom/media/webrtc/MediaTrackConstraints.h
+++ b/dom/media/webrtc/MediaTrackConstraints.h
@@ -90,28 +90,22 @@ public:
     }
     bool Merge(const Range& aOther) {
       if (!Intersects(aOther)) {
         return false;
       }
       Intersect(aOther);
 
       if (aOther.mIdeal.isSome()) {
-        // Ideal values, as stored, may be outside their min max range, so use
-        // clamped values in averaging, to avoid extreme outliers skewing results.
         if (mIdeal.isNothing()) {
-          mIdeal.emplace(aOther.Get(0));
+          mIdeal.emplace(aOther.mIdeal.value());
           mMergeDenominator = 1;
         } else {
-          if (!mMergeDenominator) {
-            *mIdeal = Get(0);
-            mMergeDenominator = 1;
-          }
-          *mIdeal += aOther.Get(0);
-          mMergeDenominator++;
+          *mIdeal += aOther.mIdeal.value();
+          mMergeDenominator = std::max(2U, mMergeDenominator + 1);
         }
       }
       return true;
     }
     void FinalizeMerge() override
     {
       if (mMergeDenominator) {
         *mIdeal /= mMergeDenominator;