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

Side by Side Diff: content/renderer/media/webrtc_audio_renderer.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
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | media/PRESUBMIT.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_renderer.h" 5 #include "content/renderer/media/webrtc_audio_renderer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // we change the rate to 48000 instead. The consequence is that the native 231 // we change the rate to 48000 instead. The consequence is that the native
232 // layer will be opened up at 192kHz but WebRTC will provide data at 48kHz 232 // layer will be opened up at 192kHz but WebRTC will provide data at 48kHz
233 // which will then be resampled by the audio converted on the browser side 233 // which will then be resampled by the audio converted on the browser side
234 // to match the native audio layer. 234 // to match the native audio layer.
235 int sample_rate = sink_params_.sample_rate(); 235 int sample_rate = sink_params_.sample_rate();
236 DVLOG(1) << "Audio output hardware sample rate: " << sample_rate; 236 DVLOG(1) << "Audio output hardware sample rate: " << sample_rate;
237 if (sample_rate == 192000) { 237 if (sample_rate == 192000) {
238 DVLOG(1) << "Resampling from 48000 to 192000 is required"; 238 DVLOG(1) << "Resampling from 48000 to 192000 is required";
239 sample_rate = 48000; 239 sample_rate = 48000;
240 } 240 }
241 media::AudioSampleRate asr = media::AsAudioSampleRate(sample_rate); 241 media::AudioSampleRate asr;
242 if (asr != media::kUnexpectedAudioSampleRate) { 242 if (media::ToAudioSampleRate(sample_rate, &asr)) {
243 UMA_HISTOGRAM_ENUMERATION( 243 UMA_HISTOGRAM_ENUMERATION(
244 "WebRTC.AudioOutputSampleRate", asr, media::kUnexpectedAudioSampleRate); 244 "WebRTC.AudioOutputSampleRate", asr, media::kAudioSampleRateMax + 1);
245 } else { 245 } else {
246 UMA_HISTOGRAM_COUNTS("WebRTC.AudioOutputSampleRateUnexpected", 246 UMA_HISTOGRAM_COUNTS("WebRTC.AudioOutputSampleRateUnexpected",
247 sample_rate); 247 sample_rate);
248 } 248 }
249 249
250 // Verify that the reported output hardware sample rate is supported 250 // Verify that the reported output hardware sample rate is supported
251 // on the current platform. 251 // on the current platform.
252 if (std::find(&kValidOutputRates[0], 252 if (std::find(&kValidOutputRates[0],
253 &kValidOutputRates[0] + arraysize(kValidOutputRates), 253 &kValidOutputRates[0] + arraysize(kValidOutputRates),
254 sample_rate) == 254 sample_rate) ==
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 if (RemovePlayingState(source, state)) 583 if (RemovePlayingState(source, state))
584 EnterPauseState(); 584 EnterPauseState();
585 } else if (AddPlayingState(source, state)) { 585 } else if (AddPlayingState(source, state)) {
586 EnterPlayState(); 586 EnterPlayState();
587 } 587 }
588 UpdateSourceVolume(source); 588 UpdateSourceVolume(source);
589 } 589 }
590 } 590 }
591 591
592 } // namespace content 592 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | media/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698