Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 UMA_HISTOGRAM_ENUMERATION( | 75 UMA_HISTOGRAM_ENUMERATION( |
|
Ami GONE FROM CHROMIUM
2014/02/12 20:26:48
Maybe precede with a
// NOTE: PRESUBMIT_IGNORE_UMA
| |
| 76 "Media.HardwareAudioBitsPerChannel", output_params.bits_per_sample(), | 76 "Media.HardwareAudioBitsPerChannel", |
| 77 limits::kMaxBitsPerSample); | 77 output_params.bits_per_sample(), |
| 78 limits::kMaxBitsPerSample); // PRESUBMIT_IGNORE_UMA_MAX | |
| 78 UMA_HISTOGRAM_ENUMERATION( | 79 UMA_HISTOGRAM_ENUMERATION( |
| 79 "Media.HardwareAudioChannelLayout", output_params.channel_layout(), | 80 "Media.HardwareAudioChannelLayout", output_params.channel_layout(), |
| 80 CHANNEL_LAYOUT_MAX); | 81 CHANNEL_LAYOUT_MAX + 1); |
| 81 UMA_HISTOGRAM_ENUMERATION( | 82 UMA_HISTOGRAM_ENUMERATION( |
| 82 "Media.HardwareAudioChannelCount", output_params.channels(), | 83 "Media.HardwareAudioChannelCount", output_params.channels(), |
| 83 limits::kMaxChannels); | 84 limits::kMaxChannels); // PRESUBMIT_IGNORE_UMA_MAX |
| 84 | 85 |
| 85 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate()); | 86 AudioSampleRate asr; |
| 86 if (asr != kUnexpectedAudioSampleRate) { | 87 if (media::ToAudioSampleRate(output_params.sample_rate(), &asr)) { |
| 87 UMA_HISTOGRAM_ENUMERATION( | 88 UMA_HISTOGRAM_ENUMERATION( |
| 88 "Media.HardwareAudioSamplesPerSecond", asr, kUnexpectedAudioSampleRate); | 89 "Media.HardwareAudioSamplesPerSecond", asr, kAudioSampleRateMax + 1); |
| 89 } else { | 90 } else { |
| 90 UMA_HISTOGRAM_COUNTS( | 91 UMA_HISTOGRAM_COUNTS( |
| 91 "Media.HardwareAudioSamplesPerSecondUnexpected", | 92 "Media.HardwareAudioSamplesPerSecondUnexpected", |
| 92 output_params.sample_rate()); | 93 output_params.sample_rate()); |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 | 96 |
| 96 // Record UMA statistics for hardware output configuration after fallback. | 97 // Record UMA statistics for hardware output configuration after fallback. |
| 97 static void RecordFallbackStats(const AudioParameters& output_params) { | 98 static void RecordFallbackStats(const AudioParameters& output_params) { |
| 98 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", true); | 99 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", true); |
| 99 UMA_HISTOGRAM_ENUMERATION( | 100 UMA_HISTOGRAM_ENUMERATION( |
| 100 "Media.FallbackHardwareAudioBitsPerChannel", | 101 "Media.FallbackHardwareAudioBitsPerChannel", |
| 101 output_params.bits_per_sample(), limits::kMaxBitsPerSample); | 102 output_params.bits_per_sample(), |
| 103 limits::kMaxBitsPerSample); // PRESUBMIT_IGNORE_UMA_MAX | |
| 102 UMA_HISTOGRAM_ENUMERATION( | 104 UMA_HISTOGRAM_ENUMERATION( |
| 103 "Media.FallbackHardwareAudioChannelLayout", | 105 "Media.FallbackHardwareAudioChannelLayout", |
| 104 output_params.channel_layout(), CHANNEL_LAYOUT_MAX); | 106 output_params.channel_layout(), CHANNEL_LAYOUT_MAX + 1); |
| 105 UMA_HISTOGRAM_ENUMERATION( | 107 UMA_HISTOGRAM_ENUMERATION( |
| 106 "Media.FallbackHardwareAudioChannelCount", | 108 "Media.FallbackHardwareAudioChannelCount", output_params.channels(), |
| 107 output_params.channels(), limits::kMaxChannels); | 109 limits::kMaxChannels); // PRESUBMIT_IGNORE_UMA_MAX |
| 108 | 110 |
| 109 AudioSampleRate asr = media::AsAudioSampleRate(output_params.sample_rate()); | 111 AudioSampleRate asr; |
| 110 if (asr != kUnexpectedAudioSampleRate) { | 112 if (media::ToAudioSampleRate(output_params.sample_rate(), &asr)) { |
| 111 UMA_HISTOGRAM_ENUMERATION( | 113 UMA_HISTOGRAM_ENUMERATION( |
| 112 "Media.FallbackHardwareAudioSamplesPerSecond", | 114 "Media.FallbackHardwareAudioSamplesPerSecond", |
| 113 asr, kUnexpectedAudioSampleRate); | 115 asr, kAudioSampleRateMax + 1); |
| 114 } else { | 116 } else { |
| 115 UMA_HISTOGRAM_COUNTS( | 117 UMA_HISTOGRAM_COUNTS( |
| 116 "Media.FallbackHardwareAudioSamplesPerSecondUnexpected", | 118 "Media.FallbackHardwareAudioSamplesPerSecondUnexpected", |
| 117 output_params.sample_rate()); | 119 output_params.sample_rate()); |
| 118 } | 120 } |
| 119 } | 121 } |
| 120 | 122 |
| 121 // Converts low latency based |output_params| into high latency appropriate | 123 // Converts low latency based |output_params| into high latency appropriate |
| 122 // output parameters in error situations. | 124 // output parameters in error situations. |
| 123 void AudioOutputResampler::SetupFallbackParams() { | 125 void AudioOutputResampler::SetupFallbackParams() { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 if (frames > 0 && frames < dest->frames()) | 396 if (frames > 0 && frames < dest->frames()) |
| 395 dest->ZeroFramesPartial(frames, dest->frames() - frames); | 397 dest->ZeroFramesPartial(frames, dest->frames() - frames); |
| 396 return frames > 0 ? 1 : 0; | 398 return frames > 0 ? 1 : 0; |
| 397 } | 399 } |
| 398 | 400 |
| 399 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { | 401 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { |
| 400 source_callback_->OnError(stream); | 402 source_callback_->OnError(stream); |
| 401 } | 403 } |
| 402 | 404 |
| 403 } // namespace media | 405 } // namespace media |
| OLD | NEW |