Bug 245511
Summary: | The size of a video track's settings is incorrect in the second MediaStream created when the 'aspectRatio' contraint is applied | ||
---|---|---|---|
Product: | WebKit | Reporter: | inanelit |
Component: | WebRTC | Assignee: | Eric Carlson <eric.carlson> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ahmad.saleem792, akeerthi, bryan, cdumez, eric.carlson, mbrice, rniwa, webkit-bug-importer, youennf |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 16 | ||
Hardware: | All | ||
OS: | Unspecified | ||
URL: | https://codesandbox.io/s/blissful-snowflake-qdq6fo?file=/src/App.js |
inanelit
If a webcam video stream is attached to a video element that is not rendered in the DOM, and then we render a video element with the same media constraints, that video element will have incorrect videoHeight and videoWidth.
This issue repros in Safari 16 on desktop and mobile.
For an example, go to https://codesandbox.io/s/blissful-snowflake-qdq6fo?file=/src/App.js and click "Show Webcam"
In this example, a useEffect hook creates an unrendered video element and attaches a media stream to it. Clicking show webcam causes a second video element to be rendered using the same video constraints (not the same video stream), along with a canvas that we are drawing from the video to every second. The captured frame drawn on the canvas is distorted because videoHeight and videoWidth are incorrect.
Webcam used was built-in webcam for M1 Macbook Pro
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/100254156>
Ahmad Saleem
I am able to reproduce this bug in Safari 16 and Safari Technology Preview 154 and the second stream video is distorted and like crushed or squeezed. While I am not able to reproduce this in Chrome Canary 108 and Firefox Nightly 107. Just wanted to update latest testing results. Thanks!
Eric Carlson
The bug is that the sections of the second video stream track are incorrect when the 'aspectRatio' constraint is used. The camera stream is captured at the correct size, but MediaTrackSettings.width and MediaTrackSettings.height have the values of the unconstrained width and height.
Eric Carlson
Pull request: https://github.com/WebKit/WebKit/pull/6093
EWS
Committed 256433@main (fc20b78a56dc): <https://commits.webkit.org/256433@main>
Reviewed commits have been landed. Closing PR #6093 and removing active labels.