Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
|
DaleCurtis
2017/06/27 17:25:08
No (c) anymore.
Andrew MacPherson
2017/06/27 17:46:50
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "media/base/mac/audio_util_mac.h" | |
| 6 #include "media/base/limits.h" | |
| 7 | |
| 8 namespace media { | |
| 9 | |
| 10 namespace audio_util_mac { | |
| 11 | |
| 12 int GetMinAudioBufferSizeForSampleRate(int min_buffer_size, int sample_rate) { | |
| 13 int buffer_size = min_buffer_size; | |
| 14 if (sample_rate > 48000) { | |
| 15 // The default buffer size is too small for higher sample rates and may lead | |
| 16 // to glitching. Adjust upwards by multiples of the default size. | |
| 17 if (sample_rate <= 96000) | |
| 18 buffer_size = 2 * limits::kMinAudioBufferSize; | |
| 19 else if (sample_rate <= 192000) | |
| 20 buffer_size = 4 * limits::kMinAudioBufferSize; | |
| 21 } | |
| 22 return buffer_size; | |
| 23 } | |
| 24 | |
| 25 } // namespace audio_util_mac | |
| 26 | |
| 27 } // namespace media | |
| OLD | NEW |