Add number of freezes per minute metric.
Calculate number of freezes per minute for a received video stream and report this metric to UMA. Bug: webrtc:9803 Change-Id: I6d72a2daf58b2f734a576fff469c1fead6cc69b3 Reviewed-on: https://webrtc-review.googlesource.com/c/103180 Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24944}
This commit is contained in:

committed by
Commit Bot

parent
8c147b68e6
commit
bea18cacc1
@ -57,6 +57,10 @@ absl::optional<int> SampleCounter::Max() const {
|
|||||||
return max_;
|
return max_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t SampleCounter::NumSamples() const {
|
||||||
|
return num_samples_;
|
||||||
|
}
|
||||||
|
|
||||||
void SampleCounter::Reset() {
|
void SampleCounter::Reset() {
|
||||||
*this = {};
|
*this = {};
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ class SampleCounter {
|
|||||||
void Add(int sample);
|
void Add(int sample);
|
||||||
absl::optional<int> Avg(int64_t min_required_samples) const;
|
absl::optional<int> Avg(int64_t min_required_samples) const;
|
||||||
absl::optional<int> Max() const;
|
absl::optional<int> Max() const;
|
||||||
|
int64_t NumSamples() const;
|
||||||
void Reset();
|
void Reset();
|
||||||
// Adds all the samples from the |other| SampleCounter as if they were all
|
// Adds all the samples from the |other| SampleCounter as if they were all
|
||||||
// individually added using |Add(int)| method.
|
// individually added using |Add(int)| method.
|
||||||
|
@ -1055,6 +1055,8 @@ TEST_P(ReceiveStatisticsProxyTest, FreezesAreReported) {
|
|||||||
const VideoContentType content_type = GetParam();
|
const VideoContentType content_type = GetParam();
|
||||||
const int kInterFrameDelayMs = 33;
|
const int kInterFrameDelayMs = 33;
|
||||||
const int kFreezeDelayMs = 200;
|
const int kFreezeDelayMs = 200;
|
||||||
|
const int kCallDurationMs =
|
||||||
|
kMinRequiredSamples * kInterFrameDelayMs + kFreezeDelayMs;
|
||||||
for (int i = 0; i < kMinRequiredSamples; ++i) {
|
for (int i = 0; i < kMinRequiredSamples; ++i) {
|
||||||
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
|
||||||
content_type);
|
content_type);
|
||||||
@ -1068,6 +1070,7 @@ TEST_P(ReceiveStatisticsProxyTest, FreezesAreReported) {
|
|||||||
statistics_proxy_.reset();
|
statistics_proxy_.reset();
|
||||||
const int kExpectedTimeBetweenFreezes =
|
const int kExpectedTimeBetweenFreezes =
|
||||||
kInterFrameDelayMs * (kMinRequiredSamples - 1);
|
kInterFrameDelayMs * (kMinRequiredSamples - 1);
|
||||||
|
const int kExpectedNumberFreezesPerMinute = 60 * 1000 / kCallDurationMs;
|
||||||
if (videocontenttypehelpers::IsScreenshare(content_type)) {
|
if (videocontenttypehelpers::IsScreenshare(content_type)) {
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
kFreezeDelayMs + kInterFrameDelayMs,
|
kFreezeDelayMs + kInterFrameDelayMs,
|
||||||
@ -1075,11 +1078,16 @@ TEST_P(ReceiveStatisticsProxyTest, FreezesAreReported) {
|
|||||||
EXPECT_EQ(kExpectedTimeBetweenFreezes,
|
EXPECT_EQ(kExpectedTimeBetweenFreezes,
|
||||||
metrics::MinSample(
|
metrics::MinSample(
|
||||||
"WebRTC.Video.Screenshare.MeanTimeBetweenFreezesMs"));
|
"WebRTC.Video.Screenshare.MeanTimeBetweenFreezesMs"));
|
||||||
|
EXPECT_EQ(
|
||||||
|
kExpectedNumberFreezesPerMinute,
|
||||||
|
metrics::MinSample("WebRTC.Video.Screenshare.NumberFreezesPerMinute"));
|
||||||
} else {
|
} else {
|
||||||
EXPECT_EQ(kFreezeDelayMs + kInterFrameDelayMs,
|
EXPECT_EQ(kFreezeDelayMs + kInterFrameDelayMs,
|
||||||
metrics::MinSample("WebRTC.Video.MeanFreezeDurationMs"));
|
metrics::MinSample("WebRTC.Video.MeanFreezeDurationMs"));
|
||||||
EXPECT_EQ(kExpectedTimeBetweenFreezes,
|
EXPECT_EQ(kExpectedTimeBetweenFreezes,
|
||||||
metrics::MinSample("WebRTC.Video.MeanTimeBetweenFreezesMs"));
|
metrics::MinSample("WebRTC.Video.MeanTimeBetweenFreezesMs"));
|
||||||
|
EXPECT_EQ(kExpectedNumberFreezesPerMinute,
|
||||||
|
metrics::MinSample("WebRTC.Video.NumberFreezesPerMinute"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,22 +89,32 @@ void VideoQualityObserver::UpdateHistograms() {
|
|||||||
if (call_duration_ms >= kMinCallDurationMs) {
|
if (call_duration_ms >= kMinCallDurationMs) {
|
||||||
int time_spent_in_hd_percentage = static_cast<int>(
|
int time_spent_in_hd_percentage = static_cast<int>(
|
||||||
time_in_resolution_ms_[Resolution::High] * 100 / call_duration_ms);
|
time_in_resolution_ms_[Resolution::High] * 100 / call_duration_ms);
|
||||||
int time_with_blocky_video_percentage =
|
|
||||||
static_cast<int>(time_in_blocky_video_ms_ * 100 / call_duration_ms);
|
|
||||||
|
|
||||||
RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix + ".TimeInHdPercentage",
|
RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix + ".TimeInHdPercentage",
|
||||||
time_spent_in_hd_percentage);
|
time_spent_in_hd_percentage);
|
||||||
log_stream << uma_prefix << ".TimeInHdPercentage "
|
log_stream << uma_prefix << ".TimeInHdPercentage "
|
||||||
<< time_spent_in_hd_percentage << "\n";
|
<< time_spent_in_hd_percentage << "\n";
|
||||||
|
|
||||||
|
int time_with_blocky_video_percentage =
|
||||||
|
static_cast<int>(time_in_blocky_video_ms_ * 100 / call_duration_ms);
|
||||||
RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix + ".TimeInBlockyVideoPercentage",
|
RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix + ".TimeInBlockyVideoPercentage",
|
||||||
time_with_blocky_video_percentage);
|
time_with_blocky_video_percentage);
|
||||||
log_stream << uma_prefix << ".TimeInBlockyVideoPercentage "
|
log_stream << uma_prefix << ".TimeInBlockyVideoPercentage "
|
||||||
<< time_with_blocky_video_percentage << "\n";
|
<< time_with_blocky_video_percentage << "\n";
|
||||||
|
|
||||||
|
int num_resolution_downgrades_per_minute =
|
||||||
|
num_resolution_downgrades_ * 60000 / call_duration_ms;
|
||||||
RTC_HISTOGRAM_COUNTS_SPARSE_100(
|
RTC_HISTOGRAM_COUNTS_SPARSE_100(
|
||||||
uma_prefix + ".NumberResolutionDownswitchesPerMinute",
|
uma_prefix + ".NumberResolutionDownswitchesPerMinute",
|
||||||
num_resolution_downgrades_ * 60000 / call_duration_ms);
|
num_resolution_downgrades_per_minute);
|
||||||
log_stream << uma_prefix << ".NumberResolutionDownswitchesPerMinute "
|
log_stream << uma_prefix << ".NumberResolutionDownswitchesPerMinute "
|
||||||
<< num_resolution_downgrades_ * 60000 / call_duration_ms << "\n";
|
<< num_resolution_downgrades_per_minute << "\n";
|
||||||
|
|
||||||
|
int num_freezes_per_minute =
|
||||||
|
freezes_durations_.NumSamples() * 60000 / call_duration_ms;
|
||||||
|
RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix + ".NumberFreezesPerMinute",
|
||||||
|
num_freezes_per_minute);
|
||||||
|
log_stream << uma_prefix << ".NumberFreezesPerMinute "
|
||||||
|
<< num_freezes_per_minute << "\n";
|
||||||
}
|
}
|
||||||
RTC_LOG(LS_INFO) << log_stream.str();
|
RTC_LOG(LS_INFO) << log_stream.str();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user