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

Unified Diff: third_party/WebKit/Source/platform/audio/AudioDestination.cpp

Issue 1941123002: Add UMA for hardware buffer size and callback buffer size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 8 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') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/audio/AudioDestination.cpp
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
index 28649d669065421f369ffef2790765bb29decc5a..3c105a56172bb52ac15c73412e59a1531ee22501 100644
--- a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
+++ b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
@@ -27,6 +27,8 @@
*/
#include "platform/audio/AudioDestination.h"
+
+#include "platform/Histogram.h"
#include "platform/audio/AudioFIFO.h"
#include "platform/audio/AudioPullFIFO.h"
#include "public/platform/Platform.h"
@@ -54,8 +56,17 @@ AudioDestination::AudioDestination(AudioIOCallback& callback, const String& inpu
, m_sampleRate(sampleRate)
, m_isPlaying(false)
{
+ // Histogram for audioHardwareBufferSize
+ DEFINE_STATIC_LOCAL(SparseHistogram, hardwareBufferSizeHistogram,
+ ("WebAudio.AudioDestination.HardwareBuffersize"));
+ // Histogram for the actual callback size used. Typically, this is the same as
+ // audioHardwareBufferSize, but can be adjusted depending on some heuristics below.
+ DEFINE_STATIC_LOCAL(SparseHistogram, callbackBufferSizeHistogram,
Mark P 2016/05/03 21:35:23 Sparse histograms are slow. see here for details:
Raymond Toy 2016/05/03 21:43:20 This is updated only when the AudioContext is crea
+ ("WebAudio.AudioDestination.CallbackBufferSize"));
+
// Use the optimal buffer size recommended by the audio backend.
- m_callbackBufferSize = Platform::current()->audioHardwareBufferSize();
+ size_t recommendedHardwareBufferSize = Platform::current()->audioHardwareBufferSize();
+ m_callbackBufferSize = recommendedHardwareBufferSize;
#if OS(ANDROID)
// The optimum low-latency hardware buffer size is usually too small on Android for WebAudio to
@@ -81,6 +92,10 @@ AudioDestination::AudioDestination(AudioIOCallback& callback, const String& inpu
m_audioDevice = adoptPtr(Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, sampleRate, this, inputDeviceId, securityOrigin));
ASSERT(m_audioDevice);
+ // Record the sizes if we successfully created an output device.
+ hardwareBufferSizeHistogram.sample(recommendedHardwareBufferSize);
+ callbackBufferSizeHistogram.sample(m_callbackBufferSize);
+
// Create a FIFO to handle the possibility of the callback size
// not being a multiple of the render size. If the FIFO already
// contains enough data, the data will be provided directly.
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698