-
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.
WebCodecsVideoFrame::create from another WebCodecsVideoFrame is not c…
…orrect with regards to timestamp rdar://127474678 https://bugs.webkit.org/show_bug.cgi?id=273775 Reviewed by Jean-Yves Avenard. Make sure to clone in case of a different timestamp to keep WebCodecsVideoFrame and VideoFrame timestamps the same. * LayoutTests/http/wpt/webcodecs/videoFrame-clone-timestamp-expected.txt: Added. * LayoutTests/http/wpt/webcodecs/videoFrame-clone-timestamp.html: Added. * Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.cpp: (WebCore::WebCodecsVideoFrame::create): Canonical link: https://commits.webkit.org/278454@main
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
LayoutTests/http/wpt/webcodecs/videoFrame-clone-timestamp-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,3 @@ | ||
|
||
PASS VideoFrame timestamp should remain consistent when serialized | ||
|
34 changes: 34 additions & 0 deletions
34
LayoutTests/http/wpt/webcodecs/videoFrame-clone-timestamp.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,34 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<header> | ||
<script src='/resources/testharness.js'></script> | ||
<script src='/resources/testharnessreport.js'></script> | ||
</header> | ||
<body> | ||
<script> | ||
|
||
function makeOffscreenCanvas(width, height, timestamp) { | ||
let canvas = new OffscreenCanvas(width, height); | ||
let ctx = canvas.getContext('2d'); | ||
ctx.fillStyle = 'rgba(50, 100, 150, 255)'; | ||
ctx.fillRect(0, 0, width, height); | ||
return new VideoFrame(canvas, { timestamp, duration : 10 }); | ||
} | ||
|
||
promise_test(async t => { | ||
const frame1 = makeOffscreenCanvas(10, 10, 10); | ||
t.add_cleanup(() => frame1.close()); | ||
|
||
const frame2 = new VideoFrame(frame1, { timestamp: 100 }); | ||
t.add_cleanup(() => frame2.close()); | ||
|
||
const frame3 = new VideoFrame(frame1); | ||
t.add_cleanup(() => frame3.close()); | ||
|
||
assert_equals(frame1.timestamp, 10); | ||
assert_equals(frame2.timestamp, 100); | ||
assert_equals(frame3.timestamp, 10); | ||
}, "VideoFrame timestamp should remain consistent when serialized"); | ||
</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