haikuwebkit/LayoutTests/fast/mediastream/get-user-media-ideal-constr...

28 lines
945 B
HTML
Raw Permalink Normal View History

getUserMedia returns OverConstrained on Jitsi https://bugs.webkit.org/show_bug.cgi?id=210932 <rdar://problem/64403675> Reviewed by Philippe Normand. Source/WebCore: We compute the max width, max height and max frame rate across all presets. In case a preset for the max resolution is different from the preset for the max frame rate, we were selecting capture parameters that no preset can match. To fix the issue, in case the frame rate constraint is not mandatory, and we do not find a preset when starting to capture, we remove the frame rate constraint, pick the preset and choose the max frame rate from that preset. Update mock sources to have a high resolution preset with low frame rate to enable writing a test. Test: fast/mediastream/get-user-media-ideal-constraints.html * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): * platform/mediastream/RealtimeVideoCaptureSource.cpp: (WebCore::RealtimeVideoCaptureSource::bestSupportedSizeAndFrameRate): (WebCore::RealtimeVideoCaptureSource::setSizeAndFrameRate): * platform/mediastream/VideoPreset.h: (WebCore::VideoPreset::maxFrameRate const): * platform/mock/MockRealtimeMediaSourceCenter.cpp: (WebCore::defaultDevices): LayoutTests: We bumped the max width/height for mock sources and have to update existing tests according to that. * fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt: * fast/mediastream/apply-constraints-advanced-expected.txt: * fast/mediastream/apply-constraints-advanced.html: * fast/mediastream/apply-constraints-video-expected.txt: * fast/mediastream/apply-constraints-video.html: * fast/mediastream/get-user-media-ideal-constraints-expected.txt: Added. * fast/mediastream/get-user-media-ideal-constraints.html: Added. Canonical link: https://commits.webkit.org/226685@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-02 14:05:28 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test passing constraints to getUserMedia</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<video autoplay playsinline id="localVideo"></video>
<script>
promise_test(async (test) => {
localVideo.srcObject = await navigator.mediaDevices.getUserMedia({video: {width: 2000, height: 1200, frameRate: 30 }});
const settings = localVideo.srcObject.getVideoTracks()[0].getSettings();
assert_equals(settings.width, 2000, "settings width");
assert_equals(settings.height, 1200, "settings width");
assert_equals(settings.frameRate, 10, "settings frameRate");
await localVideo.play();
assert_equals(localVideo.videoWidth, 2000, "video width");
assert_equals(localVideo.videoHeight, 1200, "video height");
}, "Ideal constraints");
</script>
</body>
</html>