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

Unified Diff: content/renderer/media/media_stream_audio_processor.cc

Issue 200293002: added uma stats to check the usage of media stream audio track audio processing (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the indentation and EXPECT_EQ Created 6 years, 9 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: content/renderer/media/media_stream_audio_processor.cc
diff --git a/content/renderer/media/media_stream_audio_processor.cc b/content/renderer/media/media_stream_audio_processor.cc
index 11e889259c0045346b9e5714ade5649ef5aa6fdf..539d054e565ff097c6bf5635d33ecef8b50b542d 100644
--- a/content/renderer/media/media_stream_audio_processor.cc
+++ b/content/renderer/media/media_stream_audio_processor.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/metrics/field_trial.h"
+#include "base/metrics/histogram.h"
#include "content/public/common/content_switches.h"
#include "content/renderer/media/media_stream_audio_processor_options.h"
#include "content/renderer/media/rtc_media_constraints.h"
@@ -30,10 +31,23 @@ const int kAudioProcessingSampleRate = 16000;
#else
const int kAudioProcessingSampleRate = 32000;
#endif
-const int kAudioProcessingNumberOfChannel = 1;
+const int kAudioProcessingNumberOfChannels = 1;
const int kMaxNumberOfBuffersInFifo = 2;
+// Used by UMA histograms and entries shouldn't be re-ordered or removed.
+enum AudioTrackProcessingStates {
+ AUDIO_PROCESSING_ENABLED = 0,
+ AUDIO_PROCESSING_DISABLED,
+ AUDIO_PROCESSING_IN_WEBRTC,
+ AUDIO_PROCESSING_MAX
+};
+
+void RecordProcessingState(AudioTrackProcessingStates state) {
+ UMA_HISTOGRAM_ENUMERATION("Media.AudioTrackProcessingStates",
+ state, AUDIO_PROCESSING_MAX);
+}
+
} // namespace
class MediaStreamAudioProcessor::MediaStreamAudioConverter
@@ -265,8 +279,10 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
const blink::WebMediaConstraints& constraints, int effects,
MediaStreamType type) {
DCHECK(!audio_processing_);
- if (!IsAudioTrackProcessingEnabled())
+ if (!IsAudioTrackProcessingEnabled()) {
+ RecordProcessingState(AUDIO_PROCESSING_IN_WEBRTC);
return;
+ }
RTCMediaConstraints native_constraints(constraints);
@@ -319,6 +335,7 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
if (!enable_aec && !enable_experimental_aec && !enable_ns &&
!enable_high_pass_filter && !enable_typing_detection && !enable_agc &&
!enable_experimental_ns) {
+ RecordProcessingState(AUDIO_PROCESSING_DISABLED);
return;
}
@@ -356,11 +373,12 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
// Configure the audio format the audio processing is running on. This
// has to be done after all the needed components are enabled.
- CHECK_EQ(audio_processing_->set_sample_rate_hz(kAudioProcessingSampleRate),
- 0);
- CHECK_EQ(audio_processing_->set_num_channels(kAudioProcessingNumberOfChannel,
- kAudioProcessingNumberOfChannel),
- 0);
+ CHECK_EQ(0,
+ audio_processing_->set_sample_rate_hz(kAudioProcessingSampleRate));
+ CHECK_EQ(0, audio_processing_->set_num_channels(
+ kAudioProcessingNumberOfChannels, kAudioProcessingNumberOfChannels));
+
+ RecordProcessingState(AUDIO_PROCESSING_ENABLED);
}
void MediaStreamAudioProcessor::InitializeCaptureConverter(
@@ -376,7 +394,7 @@ void MediaStreamAudioProcessor::InitializeCaptureConverter(
const int sink_sample_rate = audio_processing_ ?
kAudioProcessingSampleRate : source_params.sample_rate();
const media::ChannelLayout sink_channel_layout = audio_processing_ ?
- media::GuessChannelLayout(kAudioProcessingNumberOfChannel) :
+ media::GuessChannelLayout(kAudioProcessingNumberOfChannels) :
source_params.channel_layout();
// WebRtc AudioProcessing requires 10ms as its packet size. We use this
« 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