OLD | NEW |
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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const int output_buffer_size_; | 86 const int output_buffer_size_; |
87 | 87 |
88 // For audio debug recordings. | 88 // For audio debug recordings. |
89 std::unique_ptr<AudioDebugRecorder> debug_recorder_; | 89 std::unique_ptr<AudioDebugRecorder> debug_recorder_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(OnMoreDataConverter); | 91 DISALLOW_COPY_AND_ASSIGN(OnMoreDataConverter); |
92 }; | 92 }; |
93 | 93 |
94 // Record UMA statistics for hardware output configuration. | 94 // Record UMA statistics for hardware output configuration. |
95 static void RecordStats(const AudioParameters& output_params) { | 95 static void RecordStats(const AudioParameters& output_params) { |
96 // Note the 'PRESUBMIT_IGNORE_UMA_MAX's below, these silence the PRESUBMIT.py | 96 UMA_HISTOGRAM_EXACT_LINEAR("Media.HardwareAudioBitsPerChannel", |
97 // check for uma enum max usage, since we're abusing UMA_HISTOGRAM_ENUMERATION | 97 output_params.bits_per_sample(), |
98 // to report a discrete value. | 98 static_cast<int>(limits::kMaxBitsPerSample)); |
99 UMA_HISTOGRAM_ENUMERATION( | |
100 "Media.HardwareAudioBitsPerChannel", | |
101 output_params.bits_per_sample(), | |
102 limits::kMaxBitsPerSample); // PRESUBMIT_IGNORE_UMA_MAX | |
103 UMA_HISTOGRAM_ENUMERATION( | 99 UMA_HISTOGRAM_ENUMERATION( |
104 "Media.HardwareAudioChannelLayout", output_params.channel_layout(), | 100 "Media.HardwareAudioChannelLayout", output_params.channel_layout(), |
105 CHANNEL_LAYOUT_MAX + 1); | 101 CHANNEL_LAYOUT_MAX + 1); |
106 UMA_HISTOGRAM_ENUMERATION( | 102 UMA_HISTOGRAM_EXACT_LINEAR("Media.HardwareAudioChannelCount", |
107 "Media.HardwareAudioChannelCount", output_params.channels(), | 103 output_params.channels(), |
108 limits::kMaxChannels); // PRESUBMIT_IGNORE_UMA_MAX | 104 static_cast<int>(limits::kMaxChannels)); |
109 | 105 |
110 AudioSampleRate asr; | 106 AudioSampleRate asr; |
111 if (ToAudioSampleRate(output_params.sample_rate(), &asr)) { | 107 if (ToAudioSampleRate(output_params.sample_rate(), &asr)) { |
112 UMA_HISTOGRAM_ENUMERATION( | 108 UMA_HISTOGRAM_ENUMERATION( |
113 "Media.HardwareAudioSamplesPerSecond", asr, kAudioSampleRateMax + 1); | 109 "Media.HardwareAudioSamplesPerSecond", asr, kAudioSampleRateMax + 1); |
114 } else { | 110 } else { |
115 UMA_HISTOGRAM_COUNTS( | 111 UMA_HISTOGRAM_COUNTS( |
116 "Media.HardwareAudioSamplesPerSecondUnexpected", | 112 "Media.HardwareAudioSamplesPerSecondUnexpected", |
117 output_params.sample_rate()); | 113 output_params.sample_rate()); |
118 } | 114 } |
119 } | 115 } |
120 | 116 |
121 // Record UMA statistics for hardware output configuration after fallback. | 117 // Record UMA statistics for hardware output configuration after fallback. |
122 static void RecordFallbackStats(const AudioParameters& output_params) { | 118 static void RecordFallbackStats(const AudioParameters& output_params) { |
123 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", true); | 119 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", true); |
124 // Note the 'PRESUBMIT_IGNORE_UMA_MAX's below, these silence the PRESUBMIT.py | 120 UMA_HISTOGRAM_EXACT_LINEAR("Media.FallbackHardwareAudioBitsPerChannel", |
125 // check for uma enum max usage, since we're abusing UMA_HISTOGRAM_ENUMERATION | 121 output_params.bits_per_sample(), |
126 // to report a discrete value. | 122 static_cast<int>(limits::kMaxBitsPerSample)); |
127 UMA_HISTOGRAM_ENUMERATION( | |
128 "Media.FallbackHardwareAudioBitsPerChannel", | |
129 output_params.bits_per_sample(), | |
130 limits::kMaxBitsPerSample); // PRESUBMIT_IGNORE_UMA_MAX | |
131 UMA_HISTOGRAM_ENUMERATION( | 123 UMA_HISTOGRAM_ENUMERATION( |
132 "Media.FallbackHardwareAudioChannelLayout", | 124 "Media.FallbackHardwareAudioChannelLayout", |
133 output_params.channel_layout(), CHANNEL_LAYOUT_MAX + 1); | 125 output_params.channel_layout(), CHANNEL_LAYOUT_MAX + 1); |
134 UMA_HISTOGRAM_ENUMERATION( | 126 UMA_HISTOGRAM_EXACT_LINEAR("Media.FallbackHardwareAudioChannelCount", |
135 "Media.FallbackHardwareAudioChannelCount", output_params.channels(), | 127 output_params.channels(), |
136 limits::kMaxChannels); // PRESUBMIT_IGNORE_UMA_MAX | 128 static_cast<int>(limits::kMaxChannels)); |
137 | 129 |
138 AudioSampleRate asr; | 130 AudioSampleRate asr; |
139 if (ToAudioSampleRate(output_params.sample_rate(), &asr)) { | 131 if (ToAudioSampleRate(output_params.sample_rate(), &asr)) { |
140 UMA_HISTOGRAM_ENUMERATION( | 132 UMA_HISTOGRAM_ENUMERATION( |
141 "Media.FallbackHardwareAudioSamplesPerSecond", | 133 "Media.FallbackHardwareAudioSamplesPerSecond", |
142 asr, kAudioSampleRateMax + 1); | 134 asr, kAudioSampleRateMax + 1); |
143 } else { | 135 } else { |
144 UMA_HISTOGRAM_COUNTS( | 136 UMA_HISTOGRAM_COUNTS( |
145 "Media.FallbackHardwareAudioSamplesPerSecondUnexpected", | 137 "Media.FallbackHardwareAudioSamplesPerSecondUnexpected", |
146 output_params.sample_rate()); | 138 output_params.sample_rate()); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 dest->ZeroFramesPartial(frames, dest->frames() - frames); | 487 dest->ZeroFramesPartial(frames, dest->frames() - frames); |
496 return frames > 0 ? 1 : 0; | 488 return frames > 0 ? 1 : 0; |
497 } | 489 } |
498 | 490 |
499 void OnMoreDataConverter::OnError() { | 491 void OnMoreDataConverter::OnError() { |
500 error_occurred_ = true; | 492 error_occurred_ = true; |
501 source_callback_->OnError(); | 493 source_callback_->OnError(); |
502 } | 494 } |
503 | 495 |
504 } // namespace media | 496 } // namespace media |
OLD | NEW |