Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0a9bdfd79fa76af5dc4cc4689a34ea2db2fe086f
      
https://github.com/WebKit/WebKit/commit/0a9bdfd79fa76af5dc4cc4689a34ea2db2fe086f
  Author: Youenn Fablet <[email protected]>
  Date:   2024-09-23 (Mon, 23 Sep 2024)

  Changed paths:
    M LayoutTests/fast/mediastream/resources/getDisplayMedia-utils.js
    M Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.cpp
    M Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.h
    M Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.h
    M Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm
    M Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp
    M Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp

  Log Message:
  -----------
  getDisplayMedia video track getSettings() is not returning correct results 
until getting the first video frame
rdar://136359711
https://bugs.webkit.org/show_bug.cgi?id=280058

Reviewed by Eric Carlson.

Our display capturer is only able to compute the right width/height settings 
when receiving the first video frame.
Before the patch, we would return the display stream and wait for starting to 
capture to get the video frame and compute the right settings.

We are now capturing one frame to be able to compute the size settings.
We then stop capture and resolve the getDisplayMedia promise with the track 
having the correct settings.
We then start capture for real this time.

We implement this by having UserMediaCaptureManagerProxy wait on the track to 
be ready via RealtimeMediaSource::whenReady.
RealtimeMediaSource::whenReady is only implemented by DisplayCaptureSourceCocoa 
which will ask its capturer to be ready.
When capturer is ready, UserMediaCaptureManagerProxy can then signal to the 
WebProcess that it can proceed with getDisplayMedia promise resolution.

Tested by removing the workaround added in callGetDisplayMedia test routine.

* LayoutTests/fast/mediastream/resources/getDisplayMedia-utils.js:
(async callGetDisplayMedia):
* Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.cpp:
(WebCore::DisplayCaptureSourceCocoa::whenReady):
* Source/WebCore/platform/mediastream/cocoa/DisplayCaptureSourceCocoa.h:
* Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.h:
* Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm:
(WebCore::ScreenCaptureKitCaptureSource::~ScreenCaptureKitCaptureSource):
(WebCore::ScreenCaptureKitCaptureSource::whenReady):
(WebCore::ScreenCaptureKitCaptureSource::start):
(WebCore::ScreenCaptureKitCaptureSource::streamDidOutputVideoSampleBuffer):
* Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp:
(WebCore::m_readyTimer):
(WebCore::MockDisplayCapturer::start):
(WebCore::MockDisplayCapturer::stop):
(WebCore::MockDisplayCapturer::whenReady):
(WebCore::MockDisplayCapturer::readyTimerFired):
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):

Canonical link: https://commits.webkit.org/284080@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to