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

Side by Side Diff: media/audio/audio_output_resampler.cc

Issue 148553003: Clean up histogram'd media enum max values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 6 years, 10 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 "media/audio/audio_output_resampler.h" 5 #include "media/audio/audio_output_resampler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Handles resampling, buffering, and channel mixing between input and output 66 // Handles resampling, buffering, and channel mixing between input and output
67 // parameters. 67 // parameters.
68 AudioConverter audio_converter_; 68 AudioConverter audio_converter_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(OnMoreDataConverter); 70 DISALLOW_COPY_AND_ASSIGN(OnMoreDataConverter);
71 }; 71 };
72 72
73 // Record UMA statistics for hardware output configuration. 73 // Record UMA statistics for hardware output configuration.
74 static void RecordStats(const AudioParameters& output_params) { 74 static void RecordStats(const AudioParameters& output_params) {
75 // Note the 'PRESUBMIT_IGNORE_UMA_MAX's below, these silence the PRESUBMIT.py
76 // check for uma enum max usage, since we're abusing UMA_HISTOGRAM_ENUMERATION
77 // to report a discrete value.
75 UMA_HISTOGRAM_ENUMERATION( 78 UMA_HISTOGRAM_ENUMERATION(
76 "Media.HardwareAudioBitsPerChannel", output_params.bits_per_sample(), 79 "Media.HardwareAudioBitsPerChannel",
77 limits::kMaxBitsPerSample); 80 output_params.bits_per_sample(),
81 limits::kMaxBitsPerSample); // PRESUBMIT_IGNORE_UMA_MAX
78 UMA_HISTOGRAM_ENUMERATION( 82 UMA_HISTOGRAM_ENUMERATION(
79 "Media.HardwareAudioChannelLayout", output_params.channel_layout(), 83 "Media.HardwareAudioChannelLayout", output_params.channel_layout(),
80 CHANNEL_LAYOUT_MAX); 84 CHANNEL_LAYOUT_MAX + 1);
81 UMA_HISTOGRAM_ENUMERATION( 85 UMA_HISTOGRAM_ENUMERATION(
82 "Media.HardwareAudioChannelCount", output_params.channels(), 86 "Media.HardwareAudioChannelCount", output_params.channels(),
83 limits::kMaxChannels); 87 limits::kMaxChannels); // PRESUBMIT_IGNORE_UMA_MAX
84 88
85 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate()); 89 AudioSampleRate asr;
86 if (asr != kUnexpectedAudioSampleRate) { 90 if (media::ToAudioSampleRate(output_params.sample_rate(), &asr)) {
scherkus (not reviewing) 2014/02/25 03:44:49 remove media::
87 UMA_HISTOGRAM_ENUMERATION( 91 UMA_HISTOGRAM_ENUMERATION(
88 "Media.HardwareAudioSamplesPerSecond", asr, kUnexpectedAudioSampleRate); 92 "Media.HardwareAudioSamplesPerSecond", asr, kAudioSampleRateMax + 1);
89 } else { 93 } else {
90 UMA_HISTOGRAM_COUNTS( 94 UMA_HISTOGRAM_COUNTS(
91 "Media.HardwareAudioSamplesPerSecondUnexpected", 95 "Media.HardwareAudioSamplesPerSecondUnexpected",
92 output_params.sample_rate()); 96 output_params.sample_rate());
93 } 97 }
94 } 98 }
95 99
96 // Record UMA statistics for hardware output configuration after fallback. 100 // Record UMA statistics for hardware output configuration after fallback.
97 static void RecordFallbackStats(const AudioParameters& output_params) { 101 static void RecordFallbackStats(const AudioParameters& output_params) {
98 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", true); 102 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", true);
103 // Note the 'PRESUBMIT_IGNORE_UMA_MAX's below, these silence the PRESUBMIT.py
104 // check for uma enum max usage, since we're abusing UMA_HISTOGRAM_ENUMERATION
105 // to report a discrete value.
99 UMA_HISTOGRAM_ENUMERATION( 106 UMA_HISTOGRAM_ENUMERATION(
100 "Media.FallbackHardwareAudioBitsPerChannel", 107 "Media.FallbackHardwareAudioBitsPerChannel",
101 output_params.bits_per_sample(), limits::kMaxBitsPerSample); 108 output_params.bits_per_sample(),
109 limits::kMaxBitsPerSample); // PRESUBMIT_IGNORE_UMA_MAX
102 UMA_HISTOGRAM_ENUMERATION( 110 UMA_HISTOGRAM_ENUMERATION(
103 "Media.FallbackHardwareAudioChannelLayout", 111 "Media.FallbackHardwareAudioChannelLayout",
104 output_params.channel_layout(), CHANNEL_LAYOUT_MAX); 112 output_params.channel_layout(), CHANNEL_LAYOUT_MAX + 1);
105 UMA_HISTOGRAM_ENUMERATION( 113 UMA_HISTOGRAM_ENUMERATION(
106 "Media.FallbackHardwareAudioChannelCount", 114 "Media.FallbackHardwareAudioChannelCount", output_params.channels(),
107 output_params.channels(), limits::kMaxChannels); 115 limits::kMaxChannels); // PRESUBMIT_IGNORE_UMA_MAX
108 116
109 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate()); 117 AudioSampleRate asr;
110 if (asr != kUnexpectedAudioSampleRate) { 118 if (media::ToAudioSampleRate(output_params.sample_rate(), &asr)) {
scherkus (not reviewing) 2014/02/25 03:44:49 remove media::
111 UMA_HISTOGRAM_ENUMERATION( 119 UMA_HISTOGRAM_ENUMERATION(
112 "Media.FallbackHardwareAudioSamplesPerSecond", 120 "Media.FallbackHardwareAudioSamplesPerSecond",
113 asr, kUnexpectedAudioSampleRate); 121 asr, kAudioSampleRateMax + 1);
114 } else { 122 } else {
115 UMA_HISTOGRAM_COUNTS( 123 UMA_HISTOGRAM_COUNTS(
116 "Media.FallbackHardwareAudioSamplesPerSecondUnexpected", 124 "Media.FallbackHardwareAudioSamplesPerSecondUnexpected",
117 output_params.sample_rate()); 125 output_params.sample_rate());
118 } 126 }
119 } 127 }
120 128
121 // Converts low latency based |output_params| into high latency appropriate 129 // Converts low latency based |output_params| into high latency appropriate
122 // output parameters in error situations. 130 // output parameters in error situations.
123 void AudioOutputResampler::SetupFallbackParams() { 131 void AudioOutputResampler::SetupFallbackParams() {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (frames > 0 && frames < dest->frames()) 402 if (frames > 0 && frames < dest->frames())
395 dest->ZeroFramesPartial(frames, dest->frames() - frames); 403 dest->ZeroFramesPartial(frames, dest->frames() - frames);
396 return frames > 0 ? 1 : 0; 404 return frames > 0 ? 1 : 0;
397 } 405 }
398 406
399 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { 407 void OnMoreDataConverter::OnError(AudioOutputStream* stream) {
400 source_callback_->OnError(stream); 408 source_callback_->OnError(stream);
401 } 409 }
402 410
403 } // namespace media 411 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698