-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://bugs.webkit.org/show_bug.cgi?id=262131 rdar://116066837 Reviewed by Youenn Fablet. Add support for `torch` to MediaTrackCapabilities and MediaTrackSettings, and expose 'torch' as a supported constraint in MockRealtimeVideoSource and AVVideoCaptureSource. * LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt: * LayoutTests/fast/mediastream/mediastreamtrack-video-torch-expected.txt: Added. * LayoutTests/fast/mediastream/mediastreamtrack-video-torch.html: Added. * Source/WebCore/Modules/mediastream/MediaDevices.cpp: (WebCore::hasInvalidGetDisplayMediaConstraint): * Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp: (WebCore::MediaStreamTrack::getSettings const): * Source/WebCore/Modules/mediastream/MediaStreamTrack.h: * Source/WebCore/Modules/mediastream/MediaStreamTrack.idl: * Source/WebCore/Modules/mediastream/MediaTrackCapabilities.cpp: (WebCore::toMediaTrackCapabilities): * Source/WebCore/Modules/mediastream/MediaTrackCapabilities.h: * Source/WebCore/Modules/mediastream/MediaTrackCapabilities.idl: * 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/PAL/pal/cocoa/AVFoundationSoftLink.h: * Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm: * Source/WebCore/platform/mediastream/MediaConstraints.cpp: (WebCore::MediaTrackConstraintSetMap::filter const): (WebCore::MediaTrackConstraintSetMap::set): * Source/WebCore/platform/mediastream/MediaConstraints.h: (WebCore::MediaTrackConstraintSetMap::aspectRatio const): (WebCore::MediaTrackConstraintSetMap::facingMode const): (WebCore::MediaTrackConstraintSetMap::whiteBalanceMode const): (WebCore::MediaTrackConstraintSetMap::zoom const): (WebCore::MediaTrackConstraintSetMap::torch const): * Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::fitnessDistance): (WebCore::RealtimeMediaSource::applyConstraint): (WebCore::RealtimeMediaSource::supportsConstraint): (WebCore::RealtimeMediaSource::supportsConstraints): (WebCore::RealtimeMediaSource::setTorch): * Source/WebCore/platform/mediastream/RealtimeMediaSource.h: * Source/WebCore/platform/mediastream/RealtimeMediaSourceCapabilities.h: (WebCore::RealtimeMediaSourceCapabilities::RealtimeMediaSourceCapabilities): (WebCore::RealtimeMediaSourceCapabilities::supportsWhiteBalanceMode const): (WebCore::RealtimeMediaSourceCapabilities::whiteBalanceModes const): (WebCore::RealtimeMediaSourceCapabilities::setWhiteBalanceModes): (WebCore::RealtimeMediaSourceCapabilities::supportsTorch const): (WebCore::RealtimeMediaSourceCapabilities::torch const): (WebCore::RealtimeMediaSourceCapabilities::setTorch): * Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter): * Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp: (WebCore::RealtimeMediaSourceSettings::convertFlagsToString): (WebCore::RealtimeMediaSourceSettings::difference const): * Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.h: (WebCore::RealtimeMediaSourceSettings::allFlags): (WebCore::RealtimeMediaSourceSettings::RealtimeMediaSourceSettings): (WebCore::RealtimeMediaSourceSettings::supportsWhiteBalanceMode const): (WebCore::RealtimeMediaSourceSettings::whiteBalanceMode const): (WebCore::RealtimeMediaSourceSettings::setWhiteBalanceMode): (WebCore::RealtimeMediaSourceSettings::supportsTorch const): (WebCore::RealtimeMediaSourceSettings::torch const): (WebCore::RealtimeMediaSourceSettings::setTorch): * Source/WebCore/platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp: (WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint const): * Source/WebCore/platform/mediastream/RealtimeMediaSourceSupportedConstraints.h: (WebCore::RealtimeMediaSourceSupportedConstraints::RealtimeMediaSourceSupportedConstraints): (WebCore::RealtimeMediaSourceSupportedConstraints::supportsWhiteBalanceMode const): (WebCore::RealtimeMediaSourceSupportedConstraints::setSupportsWhiteBalanceMode): (WebCore::RealtimeMediaSourceSupportedConstraints::supportsTorch const): (WebCore::RealtimeMediaSourceSupportedConstraints::setSupportsTorch): * Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h: * Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): (WebCore::AVVideoCaptureSource::settingsDidChange): (WebCore::AVVideoCaptureSource::settings): (WebCore::AVVideoCaptureSource::capabilities): (WebCore::AVVideoCaptureSource::setSessionSizeFrameRateAndZoom): (WebCore::AVVideoCaptureSource::lockForConfiguration): (WebCore::AVVideoCaptureSource::updateWhiteBalanceMode): (WebCore::AVVideoCaptureSource::updateTorch): * Source/WebCore/platform/mock/MockMediaDevice.h: * Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::defaultDevices): * Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::capabilities): (WebCore::MockRealtimeVideoSource::settings): * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: Canonical link: https://commits.webkit.org/268853@main
- Loading branch information
1 parent
3b993ae
commit 9c0b105
Showing
33 changed files
with
441 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
LayoutTests/fast/mediastream/mediastreamtrack-video-torch-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
|
||
PASS getUserMedia torch | ||
|
32 changes: 32 additions & 0 deletions
32
LayoutTests/fast/mediastream/mediastreamtrack-video-torch.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>Camera track torch</title> | ||
<script src='../../resources/testharness.js'></script> | ||
<script src='../../resources/testharnessreport.js'></script> | ||
</head> | ||
<body> | ||
<canvas id='canvas'></canvas> | ||
<video controls autoplay width=640 height=480 playsInline id='video'></video> | ||
<script> | ||
|
||
let stream; | ||
promise_test(async (test) => { | ||
stream = await navigator.mediaDevices.getUserMedia({ video: { width : 640 } }); | ||
assert_equals(stream.getVideoTracks()[0].getSettings().torch, undefined, 'settings-1'); | ||
assert_equals(stream.getVideoTracks()[0].getCapabilities().torch, undefined, 'capabilities-1'); | ||
|
||
stream = await navigator.mediaDevices.getUserMedia({ video: { width: 640, torch : true } }); | ||
assert_equals(stream.getVideoTracks()[0].getCapabilities().torch, true, 'capabilities-2'); | ||
|
||
await stream.getVideoTracks()[0].applyConstraints({ torch : true }); | ||
assert_equals(stream.getVideoTracks()[0].getSettings().torch, true, 'settings-2'); | ||
|
||
await stream.getVideoTracks()[0].applyConstraints({ torch : false }); | ||
assert_equals(stream.getVideoTracks()[0].getSettings().torch, false, 'settings -3'); | ||
|
||
}, 'getUserMedia torch'); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.