Video Capture: List user-facing video cameras first in device
enumerations on Windows Problem: On certain Windows devices like Surface Pro 4, the default camera for GetUserMedia() is not the Front facing color camera. Further, an external camera attached to a Windows devices with multiple internal cameras isn't guaranteed to be the default camera. Cause: The MFEnumDeviceSources() API makes no guarantees about the ordering of returned Media Foundation devices. The |devices_info| vector in video_capture_device_factory_win.cc adopts this device order and the same is propagated through GetUserMedia(). Fix: Added a new FindAndSetDefaultVideoCamera() helper that iterates over |devices_info|. When an external video camera is available, it is moved to the front of |devices_info|. Otherwise, we move the internal user facing camera to the first index. Testing: Validated that: 1. The default camera on Surface Pro 4 for GetUserMedia() on: https://webrtc.github.io/samples/src/content/getusermedia/gum/ is now the front-facing color camera. 2. On a Surface device with an external camera attached, the default camera for GetUserMedia() is now the external camera. Bug: 1121374 Change-Id: Ia7b0f773b6e5012024519b1ec1a261e082af2e31 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376458Reviewed-by:Guido Urdaneta <guidou@chromium.org> Commit-Queue: Rahul Singh <rahsin@microsoft.com> Cr-Commit-Position: refs/heads/master@{#802535}
Showing
Please register or sign in to comment