Skip to content

Commit

Permalink
Bug 1876843 - Vendor libwebrtc from 79ba9b0b2b
Browse files Browse the repository at this point in the history
Upstream commit: https://webrtc.googlesource.com/src/+/79ba9b0b2b28e49ecc32992ff9163917299beedc
    [M121] Disable the use of CGDisplayStreamCreate() for desktop capture on Sonoma

    CGDisplayStreamCreate is an deprecated API. It was believed that the use
    of it was disabled on Sonoma through the setting allow_iosurface = false
    [1], which causes the thumbnails to be created by the API CGDisplayCreateImage.
    This API is not marked as deprecated at the moment.

    However, although the thumbnails are created through CGDisplayCreateImage,
    CGDisplayStreamCreate() is still called and runs in the background.
    This makes the capture chip appear.

    No capture chip appears if this CL is landed and the ScreenCaptureKit
    thumbnail capturer is enabled,
    --enable-features="ScreenCaptureKitMac,ScreenCaptureKitStreamPickerSonoma,ThumbnailCapturerMac:capture_mode/sc_screenshot_manager"

    [1] https://chromium-review.googlesource.com/c/chromium/src/+/4892397

    (cherry picked from commit fb99c6ebb57754e4b764a63dfae7f62ec272ba6b)

    Bug: chromium:1486851
    No-Try: True
    Change-Id: I3422efffc57dcb3e8965f19a5eca7f2a95d62da1
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334721
    Reviewed-by: Mark Foltz <mfoltz@chromium.org>
    Commit-Queue: Johannes Kron <kron@webrtc.org>
    Cr-Original-Commit-Position: refs/heads/main@{#41563}
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/335740
    Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
    Cr-Commit-Position: refs/branch-heads/6167@{#5}
    Cr-Branched-From: ece5cb83715dea85617114b6d4e981fdee2623ba-refs/heads/main@{#41315}
  • Loading branch information
jan-ivar committed Feb 12, 2024
1 parent 6c05bbe commit 4c38509
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions third_party/libwebrtc/README.moz-ff-commit
Original file line number Diff line number Diff line change
Expand Up @@ -27684,3 +27684,6 @@ ece5cb8371
# MOZ_LIBWEBRTC_SRC=/Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
0f741da200
# MOZ_LIBWEBRTC_SRC=/Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
79ba9b0b2b
2 changes: 2 additions & 0 deletions third_party/libwebrtc/README.mozilla
Original file line number Diff line number Diff line change
Expand Up @@ -18480,3 +18480,5 @@ libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc c
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-11T17:10:57.292037.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-11T17:12:06.916591.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-12T16:42:26.420193.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class DesktopFrameProvider {
// Expected to be called before stopping the CGDisplayStreamRef streams.
void Release();

bool allow_iosurface() const { return allow_iosurface_; }

private:
SequenceChecker thread_checker_;
const bool allow_iosurface_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,10 @@ DesktopRect GetExcludedWindowPixelBounds(CGWindowID window, float dip_to_pixel_s

bool ScreenCapturerMac::RegisterRefreshAndMoveHandlers() {
RTC_DCHECK(thread_checker_.IsCurrent());
if (!desktop_frame_provider_.allow_iosurface()) {
return true;
}

desktop_config_ = desktop_config_monitor_->desktop_configuration();
for (const auto& config : desktop_config_.displays) {
size_t pixel_width = config.pixel_bounds.width();
Expand Down
2 changes: 1 addition & 1 deletion third_party/libwebrtc/moz-patch-stack/0008.patch
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ index 7e38b5bd08..e4a2cc2fc9 100644

} // namespace webrtc
diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm
index 28cc410573..b082136e76 100644
index 60089fd0f2..a2370ed695 100644
--- a/modules/desktop_capture/mac/screen_capturer_mac.mm
+++ b/modules/desktop_capture/mac/screen_capturer_mac.mm
@@ -182,6 +182,7 @@ DesktopRect GetExcludedWindowPixelBounds(CGWindowID window, float dip_to_pixel_s
Expand Down
2 changes: 1 addition & 1 deletion third_party/libwebrtc/moz-patch-stack/0009.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/9314046d89ebc0836
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm
index b082136e76..1f4a62f7cd 100644
index a2370ed695..785a15dfa4 100644
--- a/modules/desktop_capture/mac/screen_capturer_mac.mm
+++ b/modules/desktop_capture/mac/screen_capturer_mac.mm
@@ -276,7 +276,8 @@ DesktopRect GetExcludedWindowPixelBounds(CGWindowID window, float dip_to_pixel_s
Expand Down

0 comments on commit 4c38509

Please sign in to comment.