Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3664d7d244e0924b68bd6fd9b24f0f6aa3a7821a
      
https://github.com/WebKit/WebKit/commit/3664d7d244e0924b68bd6fd9b24f0f6aa3a7821a
  Author: Youenn Fablet <you...@apple.com>
  Date:   2024-06-14 (Fri, 14 Jun 2024)

  Changed paths:
    M 
LayoutTests/fast/mediastream/MediaDevices-getSupportedConstraints-expected.txt
    A LayoutTests/fast/mediastream/camera-powerEfficient-track-expected.txt
    A LayoutTests/fast/mediastream/camera-powerEfficient-track.html
    M LayoutTests/fast/mediastream/getUserMedia-video-rescaling.html
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/Modules/mediastream/MediaDevices.cpp
    M Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp
    M Source/WebCore/Modules/mediastream/MediaTrackConstraints.h
    M Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl
    M Source/WebCore/Modules/mediastream/MediaTrackSupportedConstraints.h
    M Source/WebCore/Modules/mediastream/MediaTrackSupportedConstraints.idl
    M Source/WebCore/platform/mediastream/MediaConstraintType.cpp
    M Source/WebCore/platform/mediastream/MediaConstraintType.h
    M Source/WebCore/platform/mediastream/MediaConstraints.cpp
    M Source/WebCore/platform/mediastream/MediaConstraints.h
    M Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
    M Source/WebCore/platform/mediastream/RealtimeMediaSource.h
    M 
Source/WebCore/platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp
    M Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp
    M Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h
    M Source/WebCore/platform/mediastream/VideoPreset.h
    M Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h
    M Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
    M Source/WebCore/platform/mock/MockMediaDevice.h
    M Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
    M Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h
    M Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in
    M Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSource.h
    M Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp
    M Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.h

  Log Message:
  -----------
  Prefer videoBinned camera presets in case resizing is needed
https://bugs.webkit.org/show_bug.cgi?id=275317
rdar://129506159

Reviewed by Eric Carlson.

In case we select a preset that might require downsampling, it is good to favor 
binned presets as this is better for power efficiency.
Previously, we were favoring videoBinned presets if they were closer to the 
final size.

We can be more aggressive than that and favor videoBinned presets even if they 
are further from the final size.
We still try to select the smallest possible videoBinned preset.
This is implemented in RealtimeVideoCaptureSource.

As video binned format may not always be the best preset, we use the 
powerEfficientPixelFormat as a constraint that can be given to 
getUserMedia/applyConstraints
to aggressively select binned presets.
We do not expose settings and capabilities for this constraint since we only 
use it as a hint that the web application is wanting power efficiency.

We update some code to allow testing this feature.
We add a isEfficient field to VideoPreset so that we can mock efficient presets.
We have one such mock preset (environment camera, 1920 x 1080) that we use for 
testing.

We add the infrastructure to check whether a given capture track is power 
efficient or not.

We have to update 
LayoutTests/fast/mediastream/getUserMedia-video-rescaling.html given it will 
now favor 1920x1080 preset, which is 16/9.

* 
LayoutTests/fast/mediastream/MediaDevices-getSupportedConstraints-expected.txt:
* LayoutTests/fast/mediastream/camera-powerEfficient-track-expected.txt: Added.
* LayoutTests/fast/mediastream/camera-powerEfficient-track.html: Added.
* LayoutTests/fast/mediastream/getUserMedia-video-rescaling.html:
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/Modules/mediastream/MediaDevices.cpp:
(WebCore::hasInvalidGetDisplayMediaConstraint):
* Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp:
(WebCore::convertToInternalForm):
* Source/WebCore/Modules/mediastream/MediaTrackConstraints.h:
* Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl:
* Source/WebCore/Modules/mediastream/MediaTrackSupportedConstraints.h:
* Source/WebCore/Modules/mediastream/MediaTrackSupportedConstraints.idl:
* Source/WebCore/platform/mediastream/MediaConstraintType.cpp:
(WebCore::convertToString):
* Source/WebCore/platform/mediastream/MediaConstraintType.h:
* Source/WebCore/platform/mediastream/MediaConstraints.cpp:
(WebCore::MediaTrackConstraintSetMap::filter const):
(WebCore::MediaTrackConstraintSetMap::set):
(WebCore::MediaTrackConstraintSetMap::merge):
(WebCore::MediaTrackConstraintSetMap::isValid const):
(WebCore::MediaConstraints::setDefaultVideoConstraints):
(WebCore::MediaTrackConstraintSetMap::isolatedCopy const):
* Source/WebCore/platform/mediastream/MediaConstraints.h:
(WebCore::MediaTrackConstraintSetMap::MediaTrackConstraintSetMap):
(WebCore::MediaTrackConstraintSetMap::powerEfficientPixelFormat const):
* Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::fitnessDistance):
(WebCore::RealtimeMediaSource::applyConstraint):
(WebCore::RealtimeMediaSource::selectSettings):
(WebCore::RealtimeMediaSource::supportsConstraint):
(WebCore::RealtimeMediaSource::hasAnyInvalidConstraint):
(WebCore::RealtimeMediaSource::extractVideoPresetConstraints):
* Source/WebCore/platform/mediastream/RealtimeMediaSource.h:
* 
Source/WebCore/platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
(WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint const):
* Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp:
(WebCore::shouldUsePreset):
(WebCore::computePresetToUse):
(WebCore::RealtimeVideoCaptureSource::bestSupportedSizeFrameRateAndZoom):
(WebCore::RealtimeVideoCaptureSource::isPowerEfficient const):
(WebCore::RealtimeVideoCaptureSource::shouldUsePreset): Deleted.
* Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.h:
* Source/WebCore/platform/mediastream/VideoPreset.h:
(WebCore::VideoPreset::VideoPreset):
(WebCore::VideoPreset::isEfficient const):
* Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h:
* Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::isFormatPowerEfficient):
(WebCore::AVVideoCaptureSource::generatePresets):
(WebCore::AVVideoCaptureSource::prefersPreset): Deleted.
* Source/WebCore/platform/mock/MockMediaDevice.h:
* Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp:
(WebCore::defaultDevices):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::isMediaStreamTrackPowerEfficient const):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::dispatchSyncMessage):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::isPowerEfficient):
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSource.h:
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp:
(WebKit::RemoteRealtimeMediaSourceProxy::isPowerEfficient const):
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to