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

Unified Diff: media/audio/mac/audio_auhal_mac.cc

Issue 1418453004: Fix overreporting of '0' stats in the Mac audio rendering code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_auhal_mac.cc
diff --git a/media/audio/mac/audio_auhal_mac.cc b/media/audio/mac/audio_auhal_mac.cc
index 1960f141871bc056cec8877043ed3c14e2ac22cc..bd3bd8330c262fdb13220d7cbcbe635260f26916 100644
--- a/media/audio/mac/audio_auhal_mac.cc
+++ b/media/audio/mac/audio_auhal_mac.cc
@@ -149,8 +149,6 @@ void AUHALStream::Start(AudioSourceCallback* callback) {
return;
}
- ReportAndResetStats();
-
stopped_ = false;
audio_fifo_.reset();
{
@@ -179,6 +177,8 @@ void AUHALStream::Stop() {
if (result != noErr)
source_->OnError(this);
+ ReportAndResetStats();
+
base::AutoLock auto_lock(source_lock_);
source_ = NULL;
stopped_ = true;
@@ -371,12 +371,16 @@ void AUHALStream::UpdatePlayoutTimestamp(const AudioTimeStamp* timestamp) {
}
void AUHALStream::ReportAndResetStats() {
+ if (!last_sample_time_)
+ return; // No stats gathered to report.
+
// A value of 0 indicates that we got the buffer size we asked for.
UMA_HISTOGRAM_COUNTS("Media.Audio.Render.FramesRequested",
number_of_frames_requested_);
// Even if there aren't any glitches, we want to record it to get a feel for
// how often we get no glitches vs the alternative.
- UMA_HISTOGRAM_COUNTS("Media.Audio.Render.Glitches", glitches_detected_);
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Media.Audio.Render.Glitches", glitches_detected_,
+ 0, 999999, 100);
if (glitches_detected_ != 0) {
auto lost_frames_ms = (total_lost_frames_ * 1000) / params_.sample_rate();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698