OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 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_latency_mac.h" |
| 6 #include "media/base/limits.h" |
| 7 |
| 8 namespace media { |
| 9 |
| 10 int GetMinAudioBufferSizeMacOS(int min_buffer_size, int sample_rate) { |
| 11 int buffer_size = min_buffer_size; |
| 12 if (sample_rate > 48000) { |
| 13 // The default buffer size is too small for higher sample rates and may lead |
| 14 // to glitching. Adjust upwards by multiples of the default size. |
| 15 if (sample_rate <= 96000) |
| 16 buffer_size = 2 * limits::kMinAudioBufferSize; |
| 17 else if (sample_rate <= 192000) |
| 18 buffer_size = 4 * limits::kMinAudioBufferSize; |
| 19 } |
| 20 return buffer_size; |
| 21 } |
| 22 |
| 23 } // namespace media |
OLD | NEW |