Redo 587688 and 592088 to add histograms in capturer
This change redoes
https://chromium-review.googlesource.com/587688
and
https://chromium-review.googlesource.com/592088
The above two changes added histograms in webrtc capturer implementations to
track the edge cases.
After change https://chromium-review.googlesource.com/c/617845, this change
should be safe to be merged into webrtc.
Bug: webrtc:8040, webrtc:8046
Change-Id: I28b9f26227a5a231c918969d8280ede91015dbe4
Reviewed-on: https://chromium-review.googlesource.com/615852
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Zijie He <zijiehe@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#19437}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 565d046edcda84abb2f02473d7354bca902edd2f
diff --git a/modules/desktop_capture/blank_detector_desktop_capturer_wrapper.cc b/modules/desktop_capture/blank_detector_desktop_capturer_wrapper.cc
index 13d50d5..4f88d94 100644
--- a/modules/desktop_capture/blank_detector_desktop_capturer_wrapper.cc
+++ b/modules/desktop_capture/blank_detector_desktop_capturer_wrapper.cc
@@ -15,6 +15,7 @@
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
#include "webrtc/rtc_base/checks.h"
+#include "webrtc/system_wrappers/include/metrics.h"
namespace webrtc {
@@ -78,6 +79,8 @@
last_frame_is_blank_ = IsBlankFrame(*frame);
is_first_frame_ = false;
}
+ RTC_HISTOGRAM_BOOLEAN("WebRTC.DesktopCapture.BlankFrameDetected",
+ last_frame_is_blank_);
if (!last_frame_is_blank_) {
non_blank_frame_received_ = true;
callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
diff --git a/modules/desktop_capture/fallback_desktop_capturer_wrapper.cc b/modules/desktop_capture/fallback_desktop_capturer_wrapper.cc
index 0fd9b8a..8051026 100644
--- a/modules/desktop_capture/fallback_desktop_capturer_wrapper.cc
+++ b/modules/desktop_capture/fallback_desktop_capturer_wrapper.cc
@@ -13,6 +13,7 @@
#include <utility>
#include "webrtc/rtc_base/checks.h"
+#include "webrtc/system_wrappers/include/metrics.h"
namespace webrtc {
@@ -145,6 +146,10 @@
Result result,
std::unique_ptr<DesktopFrame> frame) {
RTC_DCHECK(callback_);
+ RTC_HISTOGRAM_BOOLEAN("WebRTC.DesktopCapture.PrimaryCapturerError",
+ result != Result::SUCCESS);
+ RTC_HISTOGRAM_BOOLEAN("WebRTC.DesktopCapture.PrimaryCapturerPermanentError",
+ result == Result::ERROR_PERMANENT);
if (result == Result::SUCCESS) {
callback_->OnCaptureResult(result, std::move(frame));
return;
diff --git a/modules/desktop_capture/win/dxgi_texture_staging.cc b/modules/desktop_capture/win/dxgi_texture_staging.cc
index c4415ca..3b165bd 100644
--- a/modules/desktop_capture/win/dxgi_texture_staging.cc
+++ b/modules/desktop_capture/win/dxgi_texture_staging.cc
@@ -17,6 +17,7 @@
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h"
+#include "webrtc/system_wrappers/include/metrics.h"
using Microsoft::WRL::ComPtr;
@@ -44,7 +45,11 @@
AssertStageAndSurfaceAreSameObject();
D3D11_TEXTURE2D_DESC current_desc;
stage_->GetDesc(¤t_desc);
- if (memcmp(&desc, ¤t_desc, sizeof(D3D11_TEXTURE2D_DESC)) == 0) {
+ const bool recreate_needed = (
+ memcmp(&desc, ¤t_desc, sizeof(D3D11_TEXTURE2D_DESC)) != 0);
+ RTC_HISTOGRAM_BOOLEAN("WebRTC.DesktopCapture.StagingTextureRecreate",
+ recreate_needed);
+ if (!recreate_needed) {
return true;
}