-
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.
Constraints on the max width/height cause blurry getDisplayMedia vide…
…o on Safari 17 https://bugs.webkit.org/show_bug.cgi?id=263015 rdar://116810370 Reviewed by Eric Carlson. We were applying constraints at the time of starting the capture. For getDisplayMedia, we do not know yet the size of window/screen, so we start with 640x480. Later on, the size may increase, but we were not recomputing the constraints and our resizer was sticking to the old values. Whenever there is a change of size, we are now calling configuration change. Within UserMediaCaptureManagerProxy, in case of getDisplayMedia, we will reapply constraints. This will trigger recomputation of the resizer based on any max constraint. We add a test that is emulating the change of screen being captured. We update an existing testRunner API for that purpose. * LayoutTests/fast/mediastream/getDisplayMedia-max-constraints4-expected.txt: Added. * LayoutTests/fast/mediastream/getDisplayMedia-max-constraints4.html: Added. * LayoutTests/fast/mediastream/mediastreamtrack-configurationchange.html: * LayoutTests/platform/glib/TestExpectations: * Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.cpp: (WebCore::DisplayCaptureSourceCocoa::emitFrame): * Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm: (WebCore::ScreenCaptureKitCaptureSource::streamDidOutputVideoSampleBuffer): * Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::MockDisplayCapturer::triggerMockCaptureConfigurationChange): (WebCore::MockRealtimeDisplaySourceFactory::latestCapturer): (WebCore::MockRealtimeMediaSourceCenter::triggerMockCaptureConfigurationChange): (WebCore::MockRealtimeMediaSourceCenter::triggerMockMicrophoneConfigurationChange): Deleted. * Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.h: * Source/WebKit/GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::triggerMockCaptureConfigurationChange): (WebKit::GPUProcess::triggerMockMicrophoneConfigurationChange): Deleted. * Source/WebKit/GPUProcess/GPUProcess.h: * Source/WebKit/GPUProcess/GPUProcess.messages.in: * Source/WebKit/UIProcess/API/C/WKPage.cpp: (WKPageTriggerMockCaptureConfigurationChange): (WKPageTriggerMockMicrophoneConfigurationChange): Deleted. * Source/WebKit/UIProcess/API/C/WKPagePrivate.h: * Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::updateVideoConstraints): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::applyConstraints): * Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::triggerMockCaptureConfigurationChange): (WebKit::GPUProcessProxy::triggerMockMicrophoneConfigurationChange): Deleted. * Source/WebKit/UIProcess/GPU/GPUProcessProxy.h: * Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::triggerMockCaptureConfigurationChange): (WTR::TestRunner::triggerMockMicrophoneConfigurationChange): Deleted. * Tools/WebKitTestRunner/InjectedBundle/TestRunner.h: * Tools/WebKitTestRunner/TestController.cpp: (WTR::TestController::triggerMockCaptureConfigurationChange): (WTR::TestController::triggerMockMicrophoneConfigurationChange): Deleted. * Tools/WebKitTestRunner/TestController.h: * Tools/WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): Canonical link: https://commits.webkit.org/269406@main
- Loading branch information
Showing
22 changed files
with
199 additions
and
49 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
LayoutTests/fast/mediastream/getDisplayMedia-max-constraints4-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 Underlying change of resolution should update how the constraints are used | ||
|
54 changes: 54 additions & 0 deletions
54
LayoutTests/fast/mediastream/getDisplayMedia-max-constraints4.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,54 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>getDisplayMedia track support of max constraints</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script src="resources/getDisplayMedia-utils.js"></script> | ||
</head> | ||
<body> | ||
<video id=video autoplay playsinline></video> | ||
<script> | ||
promise_test(async (test) => { | ||
const stream = await callGetDisplayMedia({ video: { height: { max: 2000 }, width : { max : 3000 } } }); | ||
video.srcObject = stream; | ||
await video.play(); | ||
|
||
const videoFrame1 = await new Promise((resolve, reject) => video.requestVideoFrameCallback(() => { | ||
resolve(new VideoFrame(video)); | ||
setTimeout(() => reject("videoFrame1 timeout"), 5000); | ||
})); | ||
|
||
assert_equals(videoFrame1.codedWidth, 1920); | ||
assert_equals(videoFrame1.codedHeight, 1080); | ||
videoFrame1.close(); | ||
|
||
const promise = new Promise((resolve, reject) => { | ||
stream.getVideoTracks()[0].onconfigurationchange = resolve; | ||
setTimeout(() => reject("configuration change timeout"), 5000); | ||
}); | ||
if (window.testRunner) | ||
testRunner.triggerMockCaptureConfigurationChange(false, true); | ||
await promise; | ||
|
||
let videoFrame2; | ||
let counter = 0; | ||
while (counter++ < 100) { | ||
if (videoFrame2) | ||
videoFrame2.close(); | ||
videoFrame2 = await new Promise((resolve, reject) => video.requestVideoFrameCallback(() => { | ||
resolve(new VideoFrame(video)); | ||
setTimeout(() => reject("videoFrame2 timeout"), 5000); | ||
})); | ||
if (videoFrame2.codedWidth > 2000) | ||
break; | ||
} | ||
assert_less_than(counter, 100); | ||
assert_equals(videoFrame2.codedWidth, 3000); | ||
assert_equals(videoFrame2.codedHeight, 1687); | ||
videoFrame2.close(); | ||
}, "Underlying change of resolution should update how the constraints are used"); | ||
</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
Oops, something went wrong.