Bug 1490700 - Ignore scaling requests to a max dimension of 0. r=jib
authorAndreas Pehrson <apehrson@mozilla.com>
Fri, 14 Sep 2018 09:16:24 +0000
changeset 436335 53e3ff3c189d4b39f069d62b055a79c4c0b43323
parent 436334 05cec36e37691d5a55c2d978f1666dd290be6767
child 436336 55cda0919f07d83f3df21e7c2f48c10ab106e522
push id34640
push usercbrindusan@mozilla.com
push dateFri, 14 Sep 2018 15:27:56 +0000
treeherdermozilla-central@619ef3811776 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1490700
milestone64.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 1490700 - Ignore scaling requests to a max dimension of 0. r=jib Differential Revision: https://phabricator.services.mozilla.com/D5784
dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
--- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
@@ -545,18 +545,20 @@ MediaEngineRemoteVideoSource::DeliverFra
 
   if (aProps.rotation() == 90 || aProps.rotation() == 270) {
     // This frame is rotated, so what was negotiated as width is now height,
     // and vice versa.
     std::swap(req_max_width, req_max_height);
     std::swap(req_ideal_width, req_ideal_height);
   }
 
-  int32_t dst_max_width = std::min(req_max_width, aProps.width());
-  int32_t dst_max_height = std::min(req_max_height, aProps.height());
+  int32_t dst_max_width = req_max_width == 0 ? aProps.width() :
+    std::min(req_max_width, aProps.width());
+  int32_t dst_max_height = req_max_height == 0 ? aProps.height() :
+    std::min(req_max_height, aProps.height());
   // This logic works for both camera and screen sharing case.
   // for camera case, req_ideal_width and req_ideal_height is 0.
   // The following snippet will set dst_width to dst_max_width and dst_height to dst_max_height
   int32_t dst_width = std::min(req_ideal_width > 0 ? req_ideal_width : aProps.width(), dst_max_width);
   int32_t dst_height = std::min(req_ideal_height > 0 ? req_ideal_height : aProps.height(), dst_max_height);
 
   // Apply scaling for screen sharing, see bug 1453269.
   switch (mMediaSource) {