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

Unified Diff: content/browser/renderer_host/media/audio_sync_reader.cc

Issue 534533002: Adding more detailed UMA histogram for detection of output audio glitches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback from Alexei Svitkine Created 6 years, 3 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 | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/audio_sync_reader.cc
diff --git a/content/browser/renderer_host/media/audio_sync_reader.cc b/content/browser/renderer_host/media/audio_sync_reader.cc
index 3daacca566ea499a15e294cd3ffffd3ef3a06917..79613da40004dc9a2adc94336cdb0825c0f8ad65 100644
--- a/content/browser/renderer_host/media/audio_sync_reader.cc
+++ b/content/browser/renderer_host/media/audio_sync_reader.cc
@@ -9,12 +9,32 @@
#include "base/command_line.h"
#include "base/memory/shared_memory.h"
#include "base/metrics/histogram.h"
+#include "base/strings/stringprintf.h"
+#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/public/common/content_switches.h"
#include "media/audio/audio_buffers_state.h"
#include "media/audio/audio_parameters.h"
using media::AudioBus;
+namespace {
+
+// Used to log if any audio glitches have been detected during an audio session.
+// Elements in this enum should not be added, deleted or rearranged.
+enum AudioGlitchResult {
+ AUDIO_RENDERER_NO_AUDIO_GLITCHES = 0,
+ AUDIO_RENDERER_AUDIO_GLITCHES = 1,
+ AUDIO_RENDERER_AUDIO_GLITCHES_MAX = AUDIO_RENDERER_AUDIO_GLITCHES
+};
+
+void LogAudioGlitchResult(AudioGlitchResult result) {
+ UMA_HISTOGRAM_ENUMERATION("Media.AudioRendererAudioGlitches",
+ result,
+ AUDIO_RENDERER_AUDIO_GLITCHES_MAX + 1);
+}
+
+} // namespace
+
namespace content {
AudioSyncReader::AudioSyncReader(base::SharedMemory* shared_memory,
@@ -47,6 +67,18 @@ AudioSyncReader::~AudioSyncReader() {
100.0 * renderer_missed_callback_count_ / renderer_callback_count_;
UMA_HISTOGRAM_PERCENTAGE(
"Media.AudioRendererMissedDeadline", percentage_missed);
+
+ // Add more detailed information regarding detected audio glitches where
+ // a non-zero value of |renderer_missed_callback_count_| is added to the
+ // AUDIO_RENDERER_AUDIO_GLITCHES bin.
+ renderer_missed_callback_count_ > 0 ?
+ LogAudioGlitchResult(AUDIO_RENDERER_AUDIO_GLITCHES) :
+ LogAudioGlitchResult(AUDIO_RENDERER_NO_AUDIO_GLITCHES);
+ std::string log_string = base::StringPrintf(
+ "ASR: number of detected audio glitches=%ld",
+ renderer_missed_callback_count_);
+ MediaStreamManager::SendMessageToNativeLog(log_string);
+ DVLOG(1) << log_string;
}
// media::AudioOutputController::SyncReader implementations.
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698