[webkit-changes] [WebKit/WebKit] bc5355: getDisplayMedia captured windows get black frames ...

youennf noreply at github.com
Thu Mar 7 09:17:08 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bc5355f67f69e837837f1519fdf132976f40d2c2
      https://github.com/WebKit/WebKit/commit/bc5355f67f69e837837f1519fdf132976f40d2c2
  Author: Youenn Fablet <youenn at apple.com>
  Date:   2024-03-07 (Thu, 07 Mar 2024)

  Changed paths:
    M Source/WebCore/PAL/pal/mac/ScreenCaptureKitSoftLink.h
    M Source/WebCore/PAL/pal/mac/ScreenCaptureKitSoftLink.mm
    M Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.h
    M Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm

  Log Message:
  -----------
  getDisplayMedia captured windows get black frames when window gets resized
https://bugs.webkit.org/show_bug.cgi?id=270568
rdar://124131045

Reviewed by Eric Carlson.

When a window size changes, we may need to update the capture size so as to respect aspect ratio and not introduce black frames.
For that purpose, we store the content size in ScreenCaptureKitCaptureSource::m_contentSize and we initialize it at start up using SCContentFilter.

Then, when capture has started, we get the content size from the sample buffer attachment, using SCStreamFrameInfoScaleFactor, SCStreamFrameInfoContentScale and SCStreamFrameInfoContentRect.
If m_contentSize changes, we update the capture size.
We ensure that the capture size keeps the aspect ratio even in case where width and height are set via media constraints by either computing width from height or the reverse but keeping aspect ratio computed from m_contentSize.

* Source/WebCore/PAL/pal/mac/ScreenCaptureKitSoftLink.h:
* Source/WebCore/PAL/pal/mac/ScreenCaptureKitSoftLink.mm:
* Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.h:
* Source/WebCore/platform/mediastream/mac/ScreenCaptureKitCaptureSource.mm:
(WebCore::ScreenCaptureKitCaptureSource::streamConfiguration):
(WebCore::ScreenCaptureKitCaptureSource::startContentStream):
(WebCore::ScreenCaptureKitCaptureSource::streamDidOutputVideoSampleBuffer):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list