Commit 2685d2e0 authored by Chris Buquicchio's avatar Chris Buquicchio Committed by Chromium LUCI CQ

Sort video capture devices.

CFMs currently rely on this behavior. It was removed in
https://chromium-review.googlesource.com/c/chromium/src/+/2306918.

BUG=b:167805373
TEST='Locally checked order of video capture devices on CFM devices.'

Change-Id: I2dc348a88b6821e7cac257ecf9710ec1c5247942
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2573196Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Auto-Submit: Chris Buquicchio <cbuquicchio@google.com>
Commit-Queue: Chris Buquicchio <cbuquicchio@google.com>
Cr-Commit-Position: refs/heads/master@{#833774}
parent a1f0357e
......@@ -37,6 +37,11 @@ namespace media {
namespace {
bool CompareCaptureDevices(const VideoCaptureDeviceInfo& a,
const VideoCaptureDeviceInfo& b) {
return a.descriptor < b.descriptor;
}
// USB VID and PID are both 4 bytes long.
const size_t kVidPidSize = 4;
const size_t kMaxInterfaceNameSize = 256;
......@@ -242,6 +247,10 @@ void VideoCaptureDeviceFactoryLinux::GetDevicesInfo(
}
}
// This is required for some applications that rely on the stable ordering of
// devices.
std::sort(devices_info.begin(), devices_info.end(), CompareCaptureDevices);
std::move(callback).Run(std::move(devices_info));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment