Bug 1320101 - mNegotiatedMaxBitrate should be able to cap the max bitrate. r=bwc,jesup
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 01 Dec 2016 16:52:41 +0100
changeset 325412 8e249f96175065170c647f4d10526af3e13d04ac
parent 325411 b0d0bb5e3cfff8d3f3f7967df7706f02b1d64831
child 325413 38e008ff60f0f595cc6f57ecbac6775166ab480a
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbwc, jesup
bugs1320101
milestone53.0a1
Bug 1320101 - mNegotiatedMaxBitrate should be able to cap the max bitrate. r=bwc,jesup MozReview-Commit-ID: 9WRUa0SKuM2
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -1182,19 +1182,18 @@ WebrtcVideoConduit::SelectBitrates(unsig
   }
   out_start = std::max(out_start, out_min);
 
   // Note: mNegotiatedMaxBitrate is the max transport bitrate - it applies to
   // a single codec encoding, but should also apply to the sum of all
   // simulcast layers in this encoding!  So sum(layers.maxBitrate) <=
   // mNegotiatedMaxBitrate
   // Note that out_max already has had mPrefMaxBitrate applied to it
-  if (mNegotiatedMaxBitrate != 0 && mNegotiatedMaxBitrate > out_max) {
-    out_max = mNegotiatedMaxBitrate;
-  }
+  out_max = MinIgnoreZero(mNegotiatedMaxBitrate, out_max);
+
   MOZ_ASSERT(mPrefMaxBitrate == 0 || out_max <= mPrefMaxBitrate);
 }
 
 static void ConstrainPreservingAspectRatioExact(uint32_t max_fs,
                                                 unsigned short* width,
                                                 unsigned short* height)
 {
   // We could try to pick a better starting divisor, but it won't make any real