Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Media recorder produces empty chunks
https://bugs.webkit.org/show_bug.cgi?id=257016 rdar://109705910 Reviewed by Eric Carlson. We were skipping video frame generation when needing preparation for display. This works fine as long as we receive the canvasDisplayBufferPrepared notification. This notification only happens if the document is observing canvas changes. If that is not the case, we schedule a capture canvas, which will trigger a video frame generation and will register the document as a canvas change observer. Making a side fix in LayoutTests/webrtc/routines.js so that computeFrameRate works fine on browsers without internals. This is necessary for LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-canvas.html in particular. * LayoutTests/http/wpt/mediarecorder/record-context-created-late-expected.txt: Added. * LayoutTests/http/wpt/mediarecorder/record-context-created-late.html: Added. * LayoutTests/webrtc/routines.js: * Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): * Source/WebCore/html/CanvasBase.cpp: (WebCore::CanvasBase::hasObserver const): * Source/WebCore/html/CanvasBase.h: Canonical link: https://commits.webkit.org/264478@main
- Loading branch information
Showing
6 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
LayoutTests/http/wpt/mediarecorder/record-context-created-late-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 Verify late canvas context creation does not break recording | ||
|
32 changes: 32 additions & 0 deletions
32
LayoutTests/http/wpt/mediarecorder/record-context-created-late.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,32 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>MediaRecorder context created late</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<canvas id="canvas" width="500" height="500"></canvas> | ||
<script> | ||
promise_test(async (t) => { | ||
const stream = canvas.captureStream(25); | ||
const mediaRecorder = new MediaRecorder(stream) | ||
mediaRecorder.start(10); | ||
|
||
setTimeout(() => { | ||
const ctx = canvas.getContext('2d'); | ||
ctx.fillStyle = 'green'; | ||
ctx.fillRect(10, 10, 150, 100); | ||
}, 100); | ||
|
||
return new Promise((resolve, reject) => { | ||
mediaRecorder.ondataavailable = (event) => { | ||
if (event.data.size > 0) | ||
resolve(); | ||
}; | ||
setTimeout(() => reject("no blob with data"), 5000); | ||
}); | ||
}, "Verify late canvas context creation does not break recording"); | ||
</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
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