Skip to content

Commit 1cfba7f

Browse files
authored
browser(webkit): periodically capture frames on mac regardless of updates
1 parent 26c5784 commit 1cfba7f

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

browser_patches/webkit/BUILD_NUMBER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
1313
2-
Changed: [email protected] Wed Jul 22 23:34:09 PDT 2020
2+
Changed: [email protected] Wed Jul 22 23:38:15 PDT 2020

browser_patches/webkit/patches/bootstrap.diff

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8325,10 +8325,10 @@ index b0722e7da81e56530deb570b82ed7cfece970362..1d1463231269363939e4c746a6dada5e
83258325
}
83268326
diff --git a/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp b/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp
83278327
new file mode 100644
8328-
index 0000000000000000000000000000000000000000..3f091aa8ea5e44980f2ea62e26ab860697c6a066
8328+
index 0000000000000000000000000000000000000000..de9e93e295e3af981965f9fd85f7f89e9da8d390
83298329
--- /dev/null
83308330
+++ b/Source/WebKit/UIProcess/Inspector/Agents/InspectorScreencastAgent.cpp
8331-
@@ -0,0 +1,166 @@
8331+
@@ -0,0 +1,163 @@
83328332
+/*
83338333
+ * Copyright (C) 2020 Microsoft Corporation.
83348334
+ *
@@ -8363,6 +8363,7 @@ index 0000000000000000000000000000000000000000..3f091aa8ea5e44980f2ea62e26ab8606
83638363
+#include <JavaScriptCore/InspectorFrontendDispatchers.h>
83648364
+#include <JavaScriptCore/InspectorFrontendRouter.h>
83658365
+#include <WebCore/NotImplemented.h>
8366+
+#include <wtf/RunLoop.h>
83668367
+
83678368
+#if USE(CAIRO)
83688369
+#include "DrawingAreaProxy.h"
@@ -8474,15 +8475,11 @@ index 0000000000000000000000000000000000000000..3f091aa8ea5e44980f2ea62e26ab8606
84748475
+ if (!m_encoder)
84758476
+ return;
84768477
+
8477-
+ m_page.callAfterNextPresentationUpdate([agent = makeWeakPtr(this)](CallbackBase::Error error) mutable {
8478+
+ RunLoop::main().dispatchAfter(Seconds(1.0 / 24), [agent = makeWeakPtr(this)]() mutable {
84788479
+ if (!agent)
84798480
+ return;
84808481
+
8481-
+ if (error == CallbackBase::Error::None) {
8482-
+ agent->encodeFrame();
8483-
+ } else {
8484-
+ fprintf(stderr, "callAfterNextPresentationUpdate failed error= %d\n", error);
8485-
+ }
8482+
+ agent->encodeFrame();
84868483
+ agent->scheduleFrameEncoding();
84878484
+ });
84888485
+}
@@ -8582,10 +8579,10 @@ index 0000000000000000000000000000000000000000..003ad364d76071ce30d11cce7d1b61a6
85828579
+} // namespace WebKit
85838580
diff --git a/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.cpp b/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.cpp
85848581
new file mode 100644
8585-
index 0000000000000000000000000000000000000000..d92957ee6d2b7ebf14eeb5c7206ea78b36927749
8582+
index 0000000000000000000000000000000000000000..9bef1bb85b02342ca8fd8129b80d7f540189dfbe
85868583
--- /dev/null
85878584
+++ b/Source/WebKit/UIProcess/Inspector/Agents/ScreencastEncoder.cpp
8588-
@@ -0,0 +1,381 @@
8585+
@@ -0,0 +1,378 @@
85898586
+/*
85908587
+ * Copyright (c) 2010, The WebM Project authors. All rights reserved.
85918588
+ * Copyright (c) 2013 The Chromium Authors. All rights reserved.
@@ -8766,10 +8763,7 @@ index 0000000000000000000000000000000000000000..d92957ee6d2b7ebf14eeb5c7206ea78b
87668763
+ {
87678764
+ m_encoderQueue->dispatch([this, frame = WTFMove(frame)] {
87688765
+ frame->convertToVpxImage(m_image.get());
8769-
+ // TODO: figure out why passing duration to the codec results in much
8770-
+ // worse visual quality and makes video stutter.
8771-
+ for (int i = 0; i < frame->duration(); i++)
8772-
+ encodeFrame(m_image.get(), 1);
8766+
+ encodeFrame(m_image.get(), frame->duration());
87738767
+ });
87748768
+ }
87758769
+

0 commit comments

Comments
 (0)