Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
The size of a video track's settings is incorrect in the second Media…
…Stream created when the 'aspectRatio' contraint is applied https://bugs.webkit.org/show_bug.cgi?id=245511 rdar://100254156 Reviewed by Youenn Fablet. * LayoutTests/fast/mediastream/cloned-video-stream-aspect-ratio-expected.txt: Added. * LayoutTests/fast/mediastream/cloned-video-stream-aspect-ratio.html: Added. * Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::size const): Apply aspectRatio to size. (WebCore::RealtimeMediaSource::setAspectRatio): Call `setSize` instead of modifying m_size directly so observers will know the size has changed. * Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp: (WebCore::RealtimeVideoSource::settingsDidChange): Call setSizeAndFrameRate when size changes so settings are updated. * Source/WebCore/platform/mediastream/RealtimeVideoSource.h: Canonical link: https://commits.webkit.org/256433@main
- Loading branch information
Showing
5 changed files
with
70 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
|
||
PASS First gUM stream | ||
PASS Second gUM stream | ||
|
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,45 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>'aspectRatio' correct with cloned media stream</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<video id=video-1 autoplay playsinline controls></video> | ||
<video id=video-2 autoplay playsinline controls></video> | ||
|
||
<script> | ||
const validateStream = async (video, message) => { | ||
|
||
const stream = await navigator.mediaDevices.getUserMedia({ video: { aspectRatio: 1 }}); | ||
|
||
const settings = stream.getVideoTracks()[0].getSettings(); | ||
assert_equals(settings.width, settings.height, `settings.width === setting.height for ${message}`); | ||
|
||
video.srcObject = stream; | ||
await new Promise((resolve, reject) => { | ||
video.oncanplay = resolve; | ||
setTimeout(() => reject(`timeout waiting for video to load for ${message}`), 5000); | ||
}); | ||
|
||
assert_equals(settings.width, video.videoWidth, `settings.width === video.videoWidth for ${message}`); | ||
assert_equals(settings.height, video.videoHeight, `settings.height === video.videoHeight for ${message}`); | ||
} | ||
|
||
promise_test(async (test) => { | ||
|
||
await validateStream(document.getElementById('video-1'), 'first stream'); | ||
|
||
}, 'First gUM stream'); | ||
|
||
promise_test(async (test) => { | ||
|
||
await validateStream(document.getElementById('video-2'), 'second stream'); | ||
|
||
}, 'Second gUM stream'); | ||
|
||
</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