Repository navigation
Commit 9da0fa4
committed
Add support for VideoFrame.rotation
https://bugs.webkit.org/show_bug.cgi?id=327664
rdar://problem/190098439
Reviewed by Philippe Normand.
We expose, under a feature flag, WebCodecs VideoFrame.rotation.
We add support for creating rotated VideoFrames as well.
We do not yet support proper rendering of rotated VideoFrames, this will be done as a follow-up.
In case the feature flag is off, there should be no observable changes.
We introduce some routines to handle rotation parsing and combining as per spec.
Covered by rebased tests and added test.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/idlharness.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/idlharness.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any.worker_av1-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any.worker_h264_annexb-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any.worker_h264_avc-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any.worker_h265_annexb-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any.worker_h265_hevc-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any.worker_vp8-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any.worker_vp9-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any_av1-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any_h264_annexb-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any_h264_avc-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any_h265_annexb-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any_h265_hevc-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any_vp8-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific-orientation.https.any_vp9-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-orientation.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-orientation.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-rotation.any-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-rotation.any.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-rotation.any.js: Added.
(makeData):
(makeFrame):
(expectedDisplaySize):
(verifyFrame):
(test):
(270.test):
(270.270.test):
(expected.of.kRotations.test):
(Infinity.test):
(promise_test.async t):
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-rotation.any.worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-rotation.any.worker.html: Added.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.cpp:
(WebCore::WebCodecsVideoFrame::create):
(WebCore::WebCodecsVideoFrame::initializeFrameFromOtherFrame):
(WebCore::WebCodecsVideoFrame::initializeFrameWithResourceAndSize):
(WebCore::WebCodecsVideoFrame::rotation const):
* Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.h:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.idl:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoFrameAlgorithms.cpp:
(WebCore::makeSureRotationIsBetween0And360):
(WebCore::parseVideoFrameRotation):
(WebCore::addVideoFrameRotations):
(WebCore::combineVideoFrameRotations):
(WebCore::initializeVisibleRectAndDisplaySize):
* Source/WebCore/Modules/webcodecs/WebCodecsVideoFrameAlgorithms.h:
* Source/WebCore/platform/VideoFrame.cpp:
(WebCore::VideoFrame::updateRotation):
(WebCore::VideoFrame::createNV12):
(WebCore::VideoFrame::createRGBA):
(WebCore::VideoFrame::createRGBX):
(WebCore::VideoFrame::createBGRA):
(WebCore::VideoFrame::createBGRX):
(WebCore::VideoFrame::createI420):
(WebCore::VideoFrame::createI420A):
* Source/WebCore/platform/VideoFrame.h:
(WebCore::is90DegreeRotation):
(WebCore::VideoFrame::has90DegreeRotation const):
* Source/WebCore/platform/graphics/cv/VideoFrameCV.mm:
(WebCore::VideoFrame::createNV12):
(WebCore::VideoFrame::createRGBA):
(WebCore::VideoFrame::createRGBX):
(WebCore::VideoFrame::createBGRA):
(WebCore::VideoFrame::createBGRX):
(WebCore::VideoFrame::createI420):
(WebCore::VideoFrame::createI420A):
* Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.cpp:
(WebCore::createOptionsWithRotation):
(WebCore::VideoFrame::createNV12):
(WebCore::VideoFrame::createRGBA):
(WebCore::VideoFrame::createBGRA):
(WebCore::VideoFrame::createRGBX):
(WebCore::VideoFrame::createBGRX):
(WebCore::VideoFrame::createI420):
(WebCore::VideoFrame::createI420A):
Canonical link: https://commits.webkit.org/324125@main1 parent 0f863d2 commit 9da0fa4
33 files changed
Lines changed: 646 additions & 78 deletions
File tree
- LayoutTests/imported/w3c/web-platform-tests/webcodecs
- Source
- WTF/Scripts/Preferences
- WebCore
- Modules/webcodecs
- platform
- graphics
- cv
- gstreamer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
0 commit comments