From 0c01606ab2ac2f4869a4fd26da216ea301a4884a Mon Sep 17 00:00:00 2001 From: Joe Downing Date: Fri, 23 Sep 2022 10:29:14 -0700 Subject: [PATCH] Add CapturerID for X11 and Wayland for telemetry Chrome Remote Desktop will support both X11 and Wayland desktop capturers in the near future and we'd like to differentiate between the two in our video frame stats and telemetry. I beleive other products are in a similar position so I would like to add a capturer ID to the frames generated by the capturer classes. Bug: chromium:1366062 Change-Id: If27c35ad6ef89b6396120982edc4dd0cf2a1e51c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276081 Commit-Queue: Joe Downing Reviewed-by: Alexander Cooper Cr-Commit-Position: refs/heads/main@{#38185} --- modules/desktop_capture/desktop_capture_types.h | 2 ++ modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc | 1 + modules/desktop_capture/linux/x11/screen_capturer_x11.cc | 1 + modules/desktop_capture/linux/x11/window_capturer_x11.cc | 1 + 4 files changed, 5 insertions(+) diff --git a/modules/desktop_capture/desktop_capture_types.h b/modules/desktop_capture/desktop_capture_types.h index f2aad8fd6f..fd5f881122 100644 --- a/modules/desktop_capture/desktop_capture_types.h +++ b/modules/desktop_capture/desktop_capture_types.h @@ -60,6 +60,8 @@ constexpr uint32_t kScreenCapturerWinMagnifier = 2; constexpr uint32_t kWindowCapturerWinGdi = 3; constexpr uint32_t kScreenCapturerWinGdi = CreateFourCC('G', 'D', 'I', ' '); constexpr uint32_t kScreenCapturerWinDirectx = CreateFourCC('D', 'X', 'G', 'I'); +constexpr uint32_t kX11CapturerLinux = CreateFourCC('X', '1', '1', ' '); +constexpr uint32_t kWaylandCapturerLinux = CreateFourCC('W', 'L', ' ', ' '); } // namespace DesktopCapturerId } // namespace webrtc diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc index 2f99876ba1..8bf0662166 100644 --- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc +++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc @@ -138,6 +138,7 @@ void BaseCapturerPipeWire::CaptureFrame() { // TODO(julien.isorce): http://crbug.com/945468. Set the icc profile on // the frame, see ScreenCapturerX11::CaptureFrame. + frame->set_capturer_id(DesktopCapturerId::kWaylandCapturerLinux); callback_->OnCaptureResult(Result::SUCCESS, std::move(frame)); } diff --git a/modules/desktop_capture/linux/x11/screen_capturer_x11.cc b/modules/desktop_capture/linux/x11/screen_capturer_x11.cc index 3cc256bdbd..4b7cbf54cb 100644 --- a/modules/desktop_capture/linux/x11/screen_capturer_x11.cc +++ b/modules/desktop_capture/linux/x11/screen_capturer_x11.cc @@ -278,6 +278,7 @@ void ScreenCapturerX11::CaptureFrame() { last_invalid_region_ = result->updated_region(); result->set_capture_time_ms((rtc::TimeNanos() - capture_start_time_nanos) / rtc::kNumNanosecsPerMillisec); + result->set_capturer_id(DesktopCapturerId::kX11CapturerLinux); callback_->OnCaptureResult(Result::SUCCESS, std::move(result)); } diff --git a/modules/desktop_capture/linux/x11/window_capturer_x11.cc b/modules/desktop_capture/linux/x11/window_capturer_x11.cc index 5b87e8cbd3..b55f7e8fa9 100644 --- a/modules/desktop_capture/linux/x11/window_capturer_x11.cc +++ b/modules/desktop_capture/linux/x11/window_capturer_x11.cc @@ -180,6 +180,7 @@ void WindowCapturerX11::CaptureFrame() { frame->mutable_updated_region()->SetRect( DesktopRect::MakeSize(frame->size())); frame->set_top_left(x_server_pixel_buffer_.window_rect().top_left()); + frame->set_capturer_id(DesktopCapturerId::kX11CapturerLinux); callback_->OnCaptureResult(Result::SUCCESS, std::move(frame)); }