From 1571258ca689458d5d940949ccbc7e66997dd03d Mon Sep 17 00:00:00 2001 From: Hunter Freyer Date: Thu, 17 Nov 2022 19:05:36 +0000 Subject: [PATCH] Fix a couple bugs in Fuchsia screen capture. 1. Use ComponentContext::Create instead of ComponentContext::CreateAndServeOutgoingDirectory. We're not actually serving an outgoing directory here, and trying to causes conflicts when this code is linked into a Fuchsia component. 2. Mark the whole screen as having been updated on each frame. Some codecs were assuming that nothing on the screen was changing, and so only the first frame would be shared. Change-Id: Icb02a2cc097947b85cceddec49291e666257ed81 Bug: webrtc:14681 Bug: webrtc:14682 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283920 Reviewed-by: Alexander Cooper Reviewed-by: Sarah Pham Commit-Queue: Hunter Freyer Cr-Commit-Position: refs/heads/main@{#38682} --- modules/desktop_capture/screen_capturer_fuchsia.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/desktop_capture/screen_capturer_fuchsia.cc b/modules/desktop_capture/screen_capturer_fuchsia.cc index c0ad841c05..19c4c735ad 100644 --- a/modules/desktop_capture/screen_capturer_fuchsia.cc +++ b/modules/desktop_capture/screen_capturer_fuchsia.cc @@ -65,8 +65,7 @@ std::unique_ptr DesktopCapturer::CreateRawScreenCapturer( } ScreenCapturerFuchsia::ScreenCapturerFuchsia() - : component_context_( - sys::ComponentContext::CreateAndServeOutgoingDirectory()) { + : component_context_(sys::ComponentContext::Create()) { RTC_DCHECK(CheckRequirements()); } @@ -86,7 +85,7 @@ ScreenCapturerFuchsia::~ScreenCapturerFuchsia() { // TODO(fxbug.dev/100303): Remove this function when Flatland is the only API. bool ScreenCapturerFuchsia::CheckRequirements() { std::unique_ptr component_context = - sys::ComponentContext::CreateAndServeOutgoingDirectory(); + sys::ComponentContext::Create(); fuchsia::ui::scenic::ScenicSyncPtr scenic; zx_status_t status = component_context->svc()->Connect(scenic.NewRequest()); if (status != ZX_OK) { @@ -163,6 +162,9 @@ void ScreenCapturerFuchsia::CaptureFrame() { uint32_t stride = kFuchsiaBytesPerPixel * pixels_per_row; frame->CopyPixelsFrom(virtual_memory_mapped_addrs_[buffer_index], stride, DesktopRect::MakeWH(width_, height_)); + // Mark the whole screen as having been updated. + frame->mutable_updated_region()->SetRect( + DesktopRect::MakeWH(width_, height_)); fuchsia::ui::composition::ScreenCapture_ReleaseFrame_Result release_result; screen_capture_->ReleaseFrame(buffer_index, &release_result);