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 "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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 UMA_HISTOGRAM_ENUMERATION( | 75 UMA_HISTOGRAM_ENUMERATION( |
76 "Media.HardwareAudioBitsPerChannel", output_params.bits_per_sample(), | 76 "Media.HardwareAudioBitsPerChannel", output_params.bits_per_sample(), |
77 limits::kMaxBitsPerSample); | 77 limits::kMaxBitsPerSample); |
78 UMA_HISTOGRAM_ENUMERATION( | 78 UMA_HISTOGRAM_ENUMERATION( |
79 "Media.HardwareAudioChannelLayout", output_params.channel_layout(), | 79 "Media.HardwareAudioChannelLayout", output_params.channel_layout(), |
80 CHANNEL_LAYOUT_MAX); | 80 CHANNEL_LAYOUT_HISTOGRAM_MAX); |
81 UMA_HISTOGRAM_ENUMERATION( | 81 UMA_HISTOGRAM_ENUMERATION( |
82 "Media.HardwareAudioChannelCount", output_params.channels(), | 82 "Media.HardwareAudioChannelCount", output_params.channels(), |
83 limits::kMaxChannels); | 83 limits::kMaxChannels); |
84 | 84 |
85 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate()); | 85 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate()); |
86 if (asr != kUnexpectedAudioSampleRate) { | 86 if (asr != kUnexpectedAudioSampleRate) { |
87 UMA_HISTOGRAM_ENUMERATION( | 87 UMA_HISTOGRAM_ENUMERATION( |
88 "Media.HardwareAudioSamplesPerSecond", asr, kUnexpectedAudioSampleRate); | 88 "Media.HardwareAudioSamplesPerSecond", asr, kUnexpectedAudioSampleRate); |
89 } else { | 89 } else { |
90 UMA_HISTOGRAM_COUNTS( | 90 UMA_HISTOGRAM_COUNTS( |
91 "Media.HardwareAudioSamplesPerSecondUnexpected", | 91 "Media.HardwareAudioSamplesPerSecondUnexpected", |
92 output_params.sample_rate()); | 92 output_params.sample_rate()); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 // Record UMA statistics for hardware output configuration after fallback. | 96 // Record UMA statistics for hardware output configuration after fallback. |
97 static void RecordFallbackStats(const AudioParameters& output_params) { | 97 static void RecordFallbackStats(const AudioParameters& output_params) { |
98 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", true); | 98 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", true); |
99 UMA_HISTOGRAM_ENUMERATION( | 99 UMA_HISTOGRAM_ENUMERATION( |
100 "Media.FallbackHardwareAudioBitsPerChannel", | 100 "Media.FallbackHardwareAudioBitsPerChannel", |
101 output_params.bits_per_sample(), limits::kMaxBitsPerSample); | 101 output_params.bits_per_sample(), limits::kMaxBitsPerSample); |
102 UMA_HISTOGRAM_ENUMERATION( | 102 UMA_HISTOGRAM_ENUMERATION( |
103 "Media.FallbackHardwareAudioChannelLayout", | 103 "Media.FallbackHardwareAudioChannelLayout", |
104 output_params.channel_layout(), CHANNEL_LAYOUT_MAX); | 104 output_params.channel_layout(), CHANNEL_LAYOUT_HISTOGRAM_MAX); |
105 UMA_HISTOGRAM_ENUMERATION( | 105 UMA_HISTOGRAM_ENUMERATION( |
106 "Media.FallbackHardwareAudioChannelCount", | 106 "Media.FallbackHardwareAudioChannelCount", |
107 output_params.channels(), limits::kMaxChannels); | 107 output_params.channels(), limits::kMaxChannels); |
108 | 108 |
109 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate()); | 109 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate()); |
110 if (asr != kUnexpectedAudioSampleRate) { | 110 if (asr != kUnexpectedAudioSampleRate) { |
111 UMA_HISTOGRAM_ENUMERATION( | 111 UMA_HISTOGRAM_ENUMERATION( |
112 "Media.FallbackHardwareAudioSamplesPerSecond", | 112 "Media.FallbackHardwareAudioSamplesPerSecond", |
113 asr, kUnexpectedAudioSampleRate); | 113 asr, kUnexpectedAudioSampleRate); |
114 } else { | 114 } else { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 if (frames > 0 && frames < dest->frames()) | 394 if (frames > 0 && frames < dest->frames()) |
395 dest->ZeroFramesPartial(frames, dest->frames() - frames); | 395 dest->ZeroFramesPartial(frames, dest->frames() - frames); |
396 return frames > 0 ? 1 : 0; | 396 return frames > 0 ? 1 : 0; |
397 } | 397 } |
398 | 398 |
399 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { | 399 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { |
400 source_callback_->OnError(stream); | 400 source_callback_->OnError(stream); |
401 } | 401 } |
402 | 402 |
403 } // namespace media | 403 } // namespace media |
OLD | NEW |