Commit fce52846 authored by braveyao's avatar braveyao Committed by Commit Bot

[desktopCapture] Let UMA only count the first permanent capture error

In some recent testings it looks like there may be multiple PERMANENT
capture error reported before the track is ended due to the first error
report.
So it's necesary to log the permanent error only once for one session.

Bug: 831756
Change-Id: Icf969f0a1f1d644bd362811cf8658cabb7d3a3a1
Reviewed-on: https://chromium-review.googlesource.com/1033818Reviewed-by: default avatarZijie He <zijiehe@chromium.org>
Commit-Queue: Weiyong Yao <braveyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554560}
parent f680291c
......@@ -181,6 +181,10 @@ class DesktopCaptureDevice::Core : public webrtc::DesktopCapturer::Callback {
// result.
bool first_capture_returned_;
// True if the first capture permanent error has been logged. Used to log the
// first capture permanent error.
bool first_permanent_error_logged;
// The type of the capturer.
DesktopMediaID::Type capturer_type_;
......@@ -208,6 +212,7 @@ DesktopCaptureDevice::Core::Core(
max_cpu_consumption_percentage_(GetMaximumCpuConsumptionPercentage()),
capture_in_progress_(false),
first_capture_returned_(false),
first_permanent_error_logged(false),
capturer_type_(type),
weak_factory_(this) {}
......@@ -300,12 +305,14 @@ void DesktopCaptureDevice::Core::OnCaptureResult(
if (!success) {
if (result == webrtc::DesktopCapturer::Result::ERROR_PERMANENT) {
if (capturer_type_ == DesktopMediaID::TYPE_SCREEN) {
IncrementDesktopCaptureCounter(SCREEN_CAPTURER_PERMANENT_ERROR);
} else {
IncrementDesktopCaptureCounter(WINDOW_CAPTURER_PERMANENT_ERROR);
if (!first_permanent_error_logged) {
first_permanent_error_logged = true;
if (capturer_type_ == DesktopMediaID::TYPE_SCREEN) {
IncrementDesktopCaptureCounter(SCREEN_CAPTURER_PERMANENT_ERROR);
} else {
IncrementDesktopCaptureCounter(WINDOW_CAPTURER_PERMANENT_ERROR);
}
}
client_->OnError(FROM_HERE, "The desktop capturer has failed.");
}
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment