Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Unified Diff: webrtc/modules/audio_coding/neteq/statistics_calculator.cc

Issue 1292423003: NetEq: Implement counting of Delayed Packet Outage Events per minute (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-metrics
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_coding/neteq/statistics_calculator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/statistics_calculator.cc
diff --git a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
index 37a0d50946fdeb4d609deca22f71632e293ec613..dd63c122253a6912bd69431dc43108353f90cf90 100644
--- a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
+++ b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
@@ -13,12 +13,36 @@
#include <assert.h>
#include <string.h> // memset
+#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/neteq/decision_logic.h"
#include "webrtc/modules/audio_coding/neteq/delay_manager.h"
#include "webrtc/system_wrappers/interface/metrics.h"
namespace webrtc {
+void StatisticsCalculator::DelayedPacketOutagesPerMinuteCounter::
+ RegisterEvent() {
+ ++counter_;
+}
+
+void StatisticsCalculator::DelayedPacketOutagesPerMinuteCounter::AdvanceClock(
+ int step_ms) {
+ timer_ += step_ms;
+ if (timer_ < kReportIntervalMs) {
+ return;
+ }
+ LogToUma();
+ counter_ = 0;
+ timer_ -= kReportIntervalMs;
+ DCHECK_GE(timer_, 0);
+}
+
+void StatisticsCalculator::DelayedPacketOutagesPerMinuteCounter::LogToUma()
+ const {
+ RTC_HISTOGRAM_COUNTS_100("WebRTC.Audio.DelayedPacketOutageEventsPerMinute",
+ counter_);
+}
+
StatisticsCalculator::StatisticsCalculator()
: preemptive_samples_(0),
accelerate_samples_(0),
@@ -84,6 +108,8 @@ void StatisticsCalculator::LostSamples(int num_samples) {
}
void StatisticsCalculator::IncreaseCounter(int num_samples, int fs_hz) {
+ delayed_packet_outage_counter_.AdvanceClock(
+ rtc::CheckedDivExact(1000 * num_samples, fs_hz));
timestamps_since_last_report_ += static_cast<uint32_t>(num_samples);
if (timestamps_since_last_report_ >
static_cast<uint32_t>(fs_hz * kMaxReportPeriod)) {
@@ -101,6 +127,7 @@ void StatisticsCalculator::LogDelayedPacketOutageEvent(int outage_duration_ms) {
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.DelayedPacketOutageEventMs",
outage_duration_ms, 1 /* min */, 2000 /* max */,
100 /* bucket count */);
+ delayed_packet_outage_counter_.RegisterEvent();
}
void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) {
« no previous file with comments | « webrtc/modules/audio_coding/neteq/statistics_calculator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698