Bug 1539220 - Prefer non-RGB24 capabilities when available; r=pehrsons
authorDan Minor <dminor@mozilla.com>
Fri, 29 Mar 2019 18:43:38 +0000
changeset 466906 c12307f3817bec87712ab5930493c3135c76b0a0
parent 466905 12fa4d0520ad825314a552cdffb87297e8d83748
child 466907 5bbf48aeb714ab2adb6983d719f454147c4f1187
push id35784
push usernerli@mozilla.com
push dateSat, 30 Mar 2019 09:32:04 +0000
treeherdermozilla-central@d42c60ccf0d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons
bugs1539220
milestone68.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 1539220 - Prefer non-RGB24 capabilities when available; r=pehrsons We've hit a number of problems with handling of RGB24 video capture on Windows. This adds a check that will ignore any RGB24 capture capabilities when determining a best match if there are other capabilities available to workaround the problems. Differential Revision: https://phabricator.services.mozilla.com/D25449
media/webrtc/trunk/webrtc/modules/video_capture/device_info_impl.cc
--- a/media/webrtc/trunk/webrtc/modules/video_capture/device_info_impl.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/device_info_impl.cc
@@ -132,20 +132,33 @@ int32_t DeviceInfoImpl::GetBestMatchedCa
   int32_t bestWidth = 0;
   int32_t bestHeight = 0;
   int32_t bestFrameRate = 0;
   VideoType bestVideoType = VideoType::kUnknown;
 
   const int32_t numberOfCapabilies =
       static_cast<int32_t>(_captureCapabilities.size());
 
+  bool hasNonRGB24Capability = false;
   for (int32_t tmp = 0; tmp < numberOfCapabilies;
        ++tmp)  // Loop through all capabilities
   {
     VideoCaptureCapability& capability = _captureCapabilities[tmp];
+    if (capability.videoType != VideoType::kRGB24) {
+      hasNonRGB24Capability = true;
+    }
+  }
+
+  for (int32_t tmp = 0; tmp < numberOfCapabilies;
+       ++tmp)  // Loop through all capabilities
+  {
+    VideoCaptureCapability& capability = _captureCapabilities[tmp];
+    if (hasNonRGB24Capability && capability.videoType == VideoType::kRGB24) {
+      continue;
+    }
 
     const int32_t diffWidth = capability.width - requested.width;
     const int32_t diffHeight = capability.height - requested.height;
     const int32_t diffFrameRate = capability.maxFPS - requested.maxFPS;
 
     const int32_t currentbestDiffWith = bestWidth - requested.width;
     const int32_t currentbestDiffHeight = bestHeight - requested.height;
     const int32_t currentbestDiffFrameRate = bestFrameRate - requested.maxFPS;