Title: [290307] trunk
Revision
290307
Author
[email protected]
Date
2022-02-22 08:05:43 -0800 (Tue, 22 Feb 2022)

Log Message

http/wpt/mediarecorder/mute-tracks.html fails with WebRTCRemoteVideoFrameEnabled=true
https://bugs.webkit.org/show_bug.cgi?id=237021

Reviewed by Kimmo Kinnunen.

Source/WebKit:

We were previously creating the black frame but still sending the remote read reference.
On GPUProcess side, we were then encoding the real frame instead of the black/muted frame.
Add a specific muted code path to fix the issue.

Covered by updated test.

* WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
(WebKit::MediaRecorderPrivate::videoSampleAvailable):
* WebProcess/GPU/webrtc/SharedVideoFrame.cpp:
(WebKit::SharedVideoFrameReader::read):

LayoutTests:

* http/wpt/mediarecorder/mute-tracks.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290306 => 290307)


--- trunk/LayoutTests/ChangeLog	2022-02-22 15:45:55 UTC (rev 290306)
+++ trunk/LayoutTests/ChangeLog	2022-02-22 16:05:43 UTC (rev 290307)
@@ -1,3 +1,12 @@
+2022-02-22  Youenn Fablet  <[email protected]>
+
+        http/wpt/mediarecorder/mute-tracks.html fails with WebRTCRemoteVideoFrameEnabled=true
+        https://bugs.webkit.org/show_bug.cgi?id=237021
+
+        Reviewed by Kimmo Kinnunen.
+
+        * http/wpt/mediarecorder/mute-tracks.html:
+
 2022-02-22  Tim Nguyen  <[email protected]>
 
         Make pointer-events checks for SVG take in account inert subtrees

Modified: trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html (290306 => 290307)


--- trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html	2022-02-22 15:45:55 UTC (rev 290306)
+++ trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html	2022-02-22 16:05:43 UTC (rev 290307)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!doctype html><!-- webkit-test-runner [ WebRTCRemoteVideoFrameEnabled=true ] -->
 <html>
 <head>
     <meta charset="utf-8">

Modified: trunk/Source/WebKit/ChangeLog (290306 => 290307)


--- trunk/Source/WebKit/ChangeLog	2022-02-22 15:45:55 UTC (rev 290306)
+++ trunk/Source/WebKit/ChangeLog	2022-02-22 16:05:43 UTC (rev 290307)
@@ -1,3 +1,21 @@
+2022-02-22  Youenn Fablet  <[email protected]>
+
+        http/wpt/mediarecorder/mute-tracks.html fails with WebRTCRemoteVideoFrameEnabled=true
+        https://bugs.webkit.org/show_bug.cgi?id=237021
+
+        Reviewed by Kimmo Kinnunen.
+
+        We were previously creating the black frame but still sending the remote read reference.
+        On GPUProcess side, we were then encoding the real frame instead of the black/muted frame.
+        Add a specific muted code path to fix the issue.
+
+        Covered by updated test.
+
+        * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
+        (WebKit::MediaRecorderPrivate::videoSampleAvailable):
+        * WebProcess/GPU/webrtc/SharedVideoFrame.cpp:
+        (WebKit::SharedVideoFrameReader::read):
+
 2022-02-22  Tim Nguyen  <[email protected]>
 
         Rename RenderStyle::userSelectIncludingInert to RenderStyle::effectiveUserSelect

Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp (290306 => 290307)


--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp	2022-02-22 15:45:55 UTC (rev 290306)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp	2022-02-22 16:05:43 UTC (rev 290307)
@@ -95,8 +95,6 @@
 
 void MediaRecorderPrivate::videoSampleAvailable(MediaSample& sample, VideoSampleMetadata)
 {
-    std::optional<RemoteVideoFrameReadReference> remoteVideoFrameReadReference;
-    std::unique_ptr<RemoteVideoSample> remoteSample;
     if (shouldMuteVideo()) {
         // FIXME: We could optimize sending black frames by only sending width/height.
         if (!m_blackFrame) {
@@ -103,23 +101,27 @@
             auto size = sample.presentationSize();
             m_blackFrame = createBlackPixelBuffer(static_cast<size_t>(size.width()), static_cast<size_t>(size.height()));
         }
-        remoteSample = RemoteVideoSample::create(m_blackFrame.get(), sample.presentationTime(), sample.videoRotation(), RemoteVideoSample::ShouldCheckForIOSurface::No);
-    } else {
-        m_blackFrame = nullptr;
-
-        if (is<RemoteVideoFrameProxy>(sample)) {
-            remoteVideoFrameReadReference = downcast<RemoteVideoFrameProxy>(sample).read();
-            remoteSample = RemoteVideoSample::create(nullptr, sample.presentationTime(), sample.videoRotation(), RemoteVideoSample::ShouldCheckForIOSurface::No);
-        } else
-            remoteSample = RemoteVideoSample::create(sample, RemoteVideoSample::ShouldCheckForIOSurface::No);
+        auto remoteSample = RemoteVideoSample::create(m_blackFrame.get(), sample.presentationTime(), sample.videoRotation(), RemoteVideoSample::ShouldCheckForIOSurface::No);
+        if (!copySharedVideoFrame(remoteSample->imageBuffer()))
+            return;
+        m_connection->send(Messages::RemoteMediaRecorder::VideoSampleAvailable { WTFMove(*remoteSample), { } }, m_identifier);
+        return;
     }
 
-    if (is<RemoteVideoFrameProxy>(sample))
+    m_blackFrame = nullptr;
+
+    std::optional<RemoteVideoFrameReadReference> remoteVideoFrameReadReference;
+    std::unique_ptr<RemoteVideoSample> remoteSample;
+    if (is<RemoteVideoFrameProxy>(sample)) {
         remoteVideoFrameReadReference = downcast<RemoteVideoFrameProxy>(sample).read();
-    else if (!remoteSample->surface()) {
-        // buffer is not IOSurface, we need to copy to shared video frame.
-        if (!copySharedVideoFrame(remoteSample->imageBuffer()))
-            return;
+        remoteSample = RemoteVideoSample::create(nullptr, sample.presentationTime(), sample.videoRotation(), RemoteVideoSample::ShouldCheckForIOSurface::No);
+    } else {
+        remoteSample = RemoteVideoSample::create(sample, RemoteVideoSample::ShouldCheckForIOSurface::No);
+        if (!remoteSample->surface()) {
+            // buffer is not IOSurface, we need to copy to shared video frame.
+            if (!copySharedVideoFrame(remoteSample->imageBuffer()))
+                return;
+        }
     }
 
     m_connection->send(Messages::RemoteMediaRecorder::VideoSampleAvailable { WTFMove(*remoteSample), remoteVideoFrameReadReference }, m_identifier);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to