Add UMA histograms to track usage of fullscreen detection

Bug: chromium:1348011
Change-Id: I3219e74c49ff77e00b2224c8cf82f78d1e0fd9cf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291708
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39254}
This commit is contained in:
Johannes Kron 2023-02-03 11:01:52 +00:00 committed by WebRTC LUCI CQ
parent 85abbdf526
commit b311f6aba8
4 changed files with 25 additions and 1 deletions

View file

@ -153,6 +153,9 @@ class CroppingWindowCapturerWin : public CroppingWindowCapturer {
bool enumerate_current_process_windows_; bool enumerate_current_process_windows_;
rtc::scoped_refptr<FullScreenWindowDetector> full_screen_window_detector_; rtc::scoped_refptr<FullScreenWindowDetector> full_screen_window_detector_;
// Used to make sure that we only log the usage of fullscreen detection once.
mutable bool fullscreen_usage_logged_ = false;
}; };
void CroppingWindowCapturerWin::CaptureFrame() { void CroppingWindowCapturerWin::CaptureFrame() {
@ -307,6 +310,10 @@ WindowId CroppingWindowCapturerWin::GetWindowToCapture() const {
full_screen_window_detector_ full_screen_window_detector_
? full_screen_window_detector_->FindFullScreenWindow(selected_source) ? full_screen_window_detector_->FindFullScreenWindow(selected_source)
: 0; : 0;
if (full_screen_source != selected_source && !fullscreen_usage_logged_) {
fullscreen_usage_logged_ = true;
LogDesktopCapturerFullscreenDetectorUsage();
}
return full_screen_source ? full_screen_source : selected_source; return full_screen_source ? full_screen_source : selected_source;
} }

View file

@ -19,6 +19,7 @@
#include "modules/desktop_capture/cropping_window_capturer.h" #include "modules/desktop_capture/cropping_window_capturer.h"
#include "modules/desktop_capture/desktop_capture_options.h" #include "modules/desktop_capture/desktop_capture_options.h"
#include "modules/desktop_capture/desktop_capturer_differ_wrapper.h" #include "modules/desktop_capture/desktop_capturer_differ_wrapper.h"
#include "system_wrappers/include/metrics.h"
#if defined(RTC_ENABLE_WIN_WGC) #if defined(RTC_ENABLE_WIN_WGC)
#include "modules/desktop_capture/win/wgc_capturer_win.h" #include "modules/desktop_capture/win/wgc_capturer_win.h"
@ -27,6 +28,10 @@
namespace webrtc { namespace webrtc {
void LogDesktopCapturerFullscreenDetectorUsage() {
RTC_HISTOGRAM_BOOLEAN("WebRTC.Screenshare.DesktopCapturerUsage", true);
}
DesktopCapturer::~DesktopCapturer() = default; DesktopCapturer::~DesktopCapturer() = default;
DelegatedSourceListController* DelegatedSourceListController*

View file

@ -32,6 +32,8 @@
namespace webrtc { namespace webrtc {
void RTC_EXPORT LogDesktopCapturerFullscreenDetectorUsage();
class DesktopCaptureOptions; class DesktopCaptureOptions;
class DesktopFrame; class DesktopFrame;

View file

@ -73,6 +73,9 @@ class WindowCapturerMac : public DesktopCapturer {
const rtc::scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_; const rtc::scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
WindowFinderMac window_finder_; WindowFinderMac window_finder_;
// Used to make sure that we only log the usage of fullscreen detection once.
bool fullscreen_usage_logged_ = false;
}; };
WindowCapturerMac::WindowCapturerMac( WindowCapturerMac::WindowCapturerMac(
@ -178,7 +181,14 @@ void WindowCapturerMac::CaptureFrame() {
CGWindowID full_screen_window = full_screen_window_detector_->FindFullScreenWindow(window_id_); CGWindowID full_screen_window = full_screen_window_detector_->FindFullScreenWindow(window_id_);
if (full_screen_window != kCGNullWindowID) on_screen_window = full_screen_window; if (full_screen_window != kCGNullWindowID) {
// If this is the first time this happens, report to UMA that the feature is active.
if (!fullscreen_usage_logged_) {
LogDesktopCapturerFullscreenDetectorUsage();
fullscreen_usage_logged_ = true;
}
on_screen_window = full_screen_window;
}
} }
std::unique_ptr<DesktopFrame> frame = DesktopFrameCGImage::CreateForWindow(on_screen_window); std::unique_ptr<DesktopFrame> frame = DesktopFrameCGImage::CreateForWindow(on_screen_window);