Chromium Code Reviews| 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..efbd3e81b0521ff4c9e30f0a7973e00513620b5b 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; |
| } |
| @@ -358,9 +375,11 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| // 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), |
| + CHECK_EQ(audio_processing_->set_num_channels( |
| + kAudioProcessingNumberOfChannels, kAudioProcessingNumberOfChannels), |
| 0); |
|
Alexei Svitkine (slow)
2014/03/19 13:59:11
Nit: Bad alignment.
Also, the expected value shou
no longer working on chromium
2014/03/24 16:31:13
Done.
|
| + |
| + RecordProcessingState(AUDIO_PROCESSING_ENABLED); |
| } |
| void MediaStreamAudioProcessor::InitializeCaptureConverter( |
| @@ -376,7 +395,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 |