Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 302d5fe7dea9aa2c8473a26803453147efc80a24
      
https://github.com/WebKit/WebKit/commit/302d5fe7dea9aa2c8473a26803453147efc80a24
  Author: Youenn Fablet <[email protected]>
  Date:   2023-04-17 (Mon, 17 Apr 2023)

  Changed paths:
    A LayoutTests/fast/mediastream/default-camera-test-expected.txt
    A LayoutTests/fast/mediastream/default-camera-test.html
    M LayoutTests/fast/mediastream/getUserMedia-default.html
    M Source/WebCore/platform/mediastream/MediaConstraints.cpp
    M Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
    M Source/WebCore/platform/mock/MockMediaDevice.h
    M Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp

  Log Message:
  -----------
  Default camera whose facingMode is unknown should be selected by getUserMedia 
if there is no facingMode constraint
https://bugs.webkit.org/show_bug.cgi?id=255451
rdar://problem/108045715

Reviewed by Eric Carlson.

Remove the facingMode constraint that was added by default to favor user facing 
cameras.
Instead, we now rely on the order of camera devices, which should favor the 
front camera over the background cameras by default.
If another camera becomes the default camera, we will favor this camera.
Selection of the default camera in case fitness distance is the same is 
guaranteed by the fact we are using a stable sort.

We update RealtimeMediaSource::selectSettings as not setting anymore the facing 
mode might end up with empty candidates in RealtimeMediaSource::selectSettings
in the case there is no provided mandatory constraints but advanced constraints 
are added.
In this case, we should not have empty candidates but all possible candidates, 
hence why we remove the early return defined in the spec.

Update test infrastructure so that adding a mock camera that has an unknown 
facing mode will make this camera the default camera.
Covered by LayoutTests/fast/mediastream/default-camera-test.html.
Updating LayoutTests/fast/mediastream/getUserMedia-default.html to expect 60fps 
since ideal is set to 60 fps and this constraint no longer competes with 
facingMode constraint.

* LayoutTests/fast/mediastream/default-camera-test-expected.txt: Added.
* LayoutTests/fast/mediastream/default-camera-test.html: Added.
* LayoutTests/fast/mediastream/getUserMedia-default.html:
* Source/WebCore/platform/mediastream/MediaConstraints.cpp:
(WebCore::addDefaultVideoConstraints):
(WebCore::MediaConstraints::setDefaultVideoConstraints):
* Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::selectSettings):
* Source/WebCore/platform/mock/MockMediaDevice.h:
(WebCore::MockMediaDevice::cameraProperties const):
* Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp:
(WebCore::createMockDevice):
(WebCore::MockRealtimeMediaSourceCenter::setDevices):
(WebCore::shouldBeDefaultDevice):
(WebCore::MockRealtimeMediaSourceCenter::addDevice):

Canonical link: https://commits.webkit.org/263022@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to