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

Side by Side Diff: content/renderer/media/webrtc_audio_capturer.cc

Issue 148553003: Clean up histogram'd media enum max values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix naming collision 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webrtc_audio_capturer.h" 5 #include "content/renderer/media/webrtc_audio_capturer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (render_view_id_ == -1) { 145 if (render_view_id_ == -1) {
146 // Return true here to allow injecting a new source via 146 // Return true here to allow injecting a new source via
147 // SetCapturerSourceForTesting() at a later state. 147 // SetCapturerSourceForTesting() at a later state.
148 return true; 148 return true;
149 } 149 }
150 150
151 media::ChannelLayout channel_layout = static_cast<media::ChannelLayout>( 151 media::ChannelLayout channel_layout = static_cast<media::ChannelLayout>(
152 device_info_.device.input.channel_layout); 152 device_info_.device.input.channel_layout);
153 DVLOG(1) << "Audio input hardware channel layout: " << channel_layout; 153 DVLOG(1) << "Audio input hardware channel layout: " << channel_layout;
154 UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioInputChannelLayout", 154 UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioInputChannelLayout",
155 channel_layout, media::CHANNEL_LAYOUT_MAX); 155 channel_layout, media::CHANNEL_LAYOUT_MAX + 1);
156 156
157 // Verify that the reported input channel configuration is supported. 157 // Verify that the reported input channel configuration is supported.
158 if (channel_layout != media::CHANNEL_LAYOUT_MONO && 158 if (channel_layout != media::CHANNEL_LAYOUT_MONO &&
159 channel_layout != media::CHANNEL_LAYOUT_STEREO) { 159 channel_layout != media::CHANNEL_LAYOUT_STEREO) {
160 DLOG(ERROR) << channel_layout 160 DLOG(ERROR) << channel_layout
161 << " is not a supported input channel configuration."; 161 << " is not a supported input channel configuration.";
162 return false; 162 return false;
163 } 163 }
164 164
165 DVLOG(1) << "Audio input hardware sample rate: " 165 DVLOG(1) << "Audio input hardware sample rate: "
166 << device_info_.device.input.sample_rate; 166 << device_info_.device.input.sample_rate;
167 media::AudioSampleRate asr = media::AsAudioSampleRate( 167 media::AudioSampleRate asr;
168 device_info_.device.input.sample_rate); 168 if (media::ToAudioSampleRate(device_info_.device.input.sample_rate, &asr)) {
169 if (asr != media::kUnexpectedAudioSampleRate) {
170 UMA_HISTOGRAM_ENUMERATION( 169 UMA_HISTOGRAM_ENUMERATION(
171 "WebRTC.AudioInputSampleRate", asr, media::kUnexpectedAudioSampleRate); 170 "WebRTC.AudioInputSampleRate", asr, media::kAudioSampleRateMax + 1);
172 } else { 171 } else {
173 UMA_HISTOGRAM_COUNTS("WebRTC.AudioInputSampleRateUnexpected", 172 UMA_HISTOGRAM_COUNTS("WebRTC.AudioInputSampleRateUnexpected",
174 device_info_.device.input.sample_rate); 173 device_info_.device.input.sample_rate);
175 } 174 }
176 175
177 // Verify that the reported input hardware sample rate is supported 176 // Verify that the reported input hardware sample rate is supported
178 // on the current platform. 177 // on the current platform.
179 if (std::find(&kValidInputRates[0], 178 if (std::find(&kValidInputRates[0],
180 &kValidInputRates[0] + arraysize(kValidInputRates), 179 &kValidInputRates[0] + arraysize(kValidInputRates),
181 device_info_.device.input.sample_rate) == 180 device_info_.device.input.sample_rate) ==
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 const scoped_refptr<media::AudioCapturerSource>& source, 560 const scoped_refptr<media::AudioCapturerSource>& source,
562 media::AudioParameters params) { 561 media::AudioParameters params) {
563 // Create a new audio stream as source which uses the new source. 562 // Create a new audio stream as source which uses the new source.
564 SetCapturerSource(source, params.channel_layout(), 563 SetCapturerSource(source, params.channel_layout(),
565 static_cast<float>(params.sample_rate()), 564 static_cast<float>(params.sample_rate()),
566 params.effects(), 565 params.effects(),
567 constraints_); 566 constraints_);
568 } 567 }
569 568
570 } // namespace content 569 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webmediaplayer_util.cc ('k') | content/renderer/media/webrtc_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698