Bug 1539220 - Prefer non-RGB24 capabilities when available; r=pehrsons a=pascalc
authorDan Minor <dminor@mozilla.com>
Fri, 29 Mar 2019 18:43:38 +0000
changeset 525909 df26e30d2c9e37174c887f2ee15109bd90597ca3
parent 525908 7c44e976056eca85a5b9945bc9c42ace1e9310ac
child 525910 4a34eea9a8f8314123189ca8ecdb77bf02bd4360
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons, pascalc
bugs1539220
milestone67.0
Bug 1539220 - Prefer non-RGB24 capabilities when available; r=pehrsons a=pascalc 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;