Source code

Revision control

Copy as Markdown

Other Tools

From: Dan Minor <dminor@mozilla.com>
Date: Fri, 29 Mar 2019 18:43:00 +0000
Subject: 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.
---
modules/video_capture/device_info_impl.cc | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/modules/video_capture/device_info_impl.cc b/modules/video_capture/device_info_impl.cc
index 7cccdb51a7..2a6afb3147 100644
--- a/modules/video_capture/device_info_impl.cc
+++ b/modules/video_capture/device_info_impl.cc
@@ -100,10 +100,23 @@ int32_t DeviceInfoImpl::GetBestMatchedCapability(
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;