Title: [263084] trunk
- Revision
- 263084
- Author
- [email protected]
- Date
- 2020-06-16 02:18:09 -0700 (Tue, 16 Jun 2020)
Log Message
Make sure MediaRecorder.requestData returns data with the new writer backend
https://bugs.webkit.org/show_bug.cgi?id=206929
Reviewed by Darin Adler.
Source/WebCore:
Test: http/wpt/mediarecorder/MediaRecorder-requestData.html
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::fetchData):
Flush data whenever calling fetchData.
LayoutTests:
* http/wpt/mediarecorder/MediaRecorder-requestData-expected.txt: Added.
* http/wpt/mediarecorder/MediaRecorder-requestData.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (263083 => 263084)
--- trunk/LayoutTests/ChangeLog 2020-06-16 08:56:44 UTC (rev 263083)
+++ trunk/LayoutTests/ChangeLog 2020-06-16 09:18:09 UTC (rev 263084)
@@ -1,3 +1,13 @@
+2020-06-16 youenn fablet <[email protected]>
+
+ Make sure MediaRecorder.requestData returns data with the new writer backend
+ https://bugs.webkit.org/show_bug.cgi?id=206929
+
+ Reviewed by Darin Adler.
+
+ * http/wpt/mediarecorder/MediaRecorder-requestData-expected.txt: Added.
+ * http/wpt/mediarecorder/MediaRecorder-requestData.html: Added.
+
2020-06-16 Devin Rousso <[email protected]>
REGRESSION: [ Mac ] inspector/page/setBootstrapScript-sub-frame.html is flaky failing.
Added: trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-requestData-expected.txt (0 => 263084)
--- trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-requestData-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-requestData-expected.txt 2020-06-16 09:18:09 UTC (rev 263084)
@@ -0,0 +1,4 @@
+
+
+PASS Verify MediaRecorder requestData returns data progressively
+
Added: trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-requestData.html (0 => 263084)
--- trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-requestData.html (rev 0)
+++ trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-requestData.html 2020-06-16 09:18:09 UTC (rev 263084)
@@ -0,0 +1,95 @@
+<!doctype html>
+<html>
+<head>
+ <title>MediaRecorder Dataavailable</title>
+ <link rel="help" href=""
+ <script src=""
+ <script src=""
+ <script src=""
+ <link rel="stylesheet" href=""
+</head>
+<body>
+<div>
+ <video id="player">
+ </video>
+</div>
+<div>
+ <canvas id="canvas" width="200" height="200">
+ </canvas>
+ <canvas id="frame" width="200" height="200">
+ </canvas>
+</div>
+<script>
+ if (window.internals)
+ window.internals.setUseGPUProcessForWebRTC(true);
+
+ var context;
+ var drawStartTime;
+
+ function createVideoStream() {
+ const canvas = document.getElementById("canvas");
+ context = canvas.getContext('2d');
+ return canvas.captureStream();
+ }
+
+ function doRedImageDraw() {
+ if (context) {
+ context.fillStyle = "#ff0000";
+ context.fillRect(0, 0, 200, 200);
+ if (Date.now() - drawStartTime < 500) {
+ window.requestAnimationFrame(doRedImageDraw);
+ } else {
+ drawStartTime = Date.now();
+ doGreenImageDraw();
+ }
+ }
+ }
+
+ function doGreenImageDraw() {
+ if (context) {
+ context.fillStyle = "#00ff00";
+ context.fillRect(0, 0, 200, 200);
+ if (Date.now() - drawStartTime < 2000) {
+ window.requestAnimationFrame(doGreenImageDraw);
+ }
+ }
+ }
+
+ function checkForEmptyBlobCount() {
+ if (window.internals)
+ return internals.usingAppleInternalSDK();
+ return true;
+ }
+
+ async_test(t => {
+ const video = createVideoStream();
+ const recorder = new MediaRecorder(video);
+ let nonEmptyBlobCount = 0;
+ recorder._ondataavailable_ = t.step_func(blobEvent => {
+ if (blobEvent.data.size <= 0 && checkForEmptyBlobCount())
+ return;
+ if (++nonEmptyBlobCount <= 1)
+ return;
+ recorder.stop();
+ clearTimeout(timeout);
+ clearInterval(interval);
+ t.done();
+ });
+ drawStartTime = Date.now();
+ doRedImageDraw();
+
+ recorder.start();
+
+ let interval = setInterval(() => {
+ recorder.requestData();
+ }, 500);
+
+ let timeout = setTimeout(() => {
+ console.log("Got non empty blobs: " + nonEmptyBlobCount);
+ recorder.stop();
+ assert_not_reached();
+ }, 5000);
+ }, 'Verify MediaRecorder requestData returns data progressively');
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (263083 => 263084)
--- trunk/Source/WebCore/ChangeLog 2020-06-16 08:56:44 UTC (rev 263083)
+++ trunk/Source/WebCore/ChangeLog 2020-06-16 09:18:09 UTC (rev 263084)
@@ -1,3 +1,16 @@
+2020-06-16 youenn fablet <[email protected]>
+
+ Make sure MediaRecorder.requestData returns data with the new writer backend
+ https://bugs.webkit.org/show_bug.cgi?id=206929
+
+ Reviewed by Darin Adler.
+
+ Test: http/wpt/mediarecorder/MediaRecorder-requestData.html
+
+ * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
+ (WebCore::MediaRecorderPrivateWriter::fetchData):
+ Flush data whenever calling fetchData.
+
2020-06-16 Darryl Pogue <[email protected]>
IndexedDB: Support IDBFactory databases method
Modified: trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm (263083 => 263084)
--- trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm 2020-06-16 08:56:44 UTC (rev 263083)
+++ trunk/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm 2020-06-16 09:18:09 UTC (rev 263084)
@@ -479,8 +479,30 @@
return;
}
- auto buffer = WTFMove(m_data);
- completionHandler(WTFMove(buffer));
+ if (m_hasStartedWriting) {
+ flushCompressedSampleBuffers([this, weakThis = makeWeakPtr(this), completionHandler = WTFMove(completionHandler)]() mutable {
+ if (!weakThis) {
+ completionHandler(nullptr);
+ return;
+ }
+
+ ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+ [m_writer flush];
+ ALLOW_DEPRECATED_DECLARATIONS_END
+
+ callOnMainThread([this, weakThis = WTFMove(weakThis), completionHandler = WTFMove(completionHandler)]() mutable {
+ if (!weakThis) {
+ completionHandler(nullptr);
+ return;
+ }
+
+ completionHandler(std::exchange(m_data, nullptr));
+ });
+ });
+ return;
+ }
+
+ completionHandler(std::exchange(m_data, nullptr));
}
void MediaRecorderPrivateWriter::appendData(const char* data, size_t size)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes