| Index: media/base/audio_latency.cc
|
| diff --git a/media/base/audio_latency.cc b/media/base/audio_latency.cc
|
| index 61b3724efa48cc36fc8ff7c3a545c95d7ba5bb56..05c9ac4ad18f883d4ec012f9a51fc2bd45bd2c09 100644
|
| --- a/media/base/audio_latency.cc
|
| +++ b/media/base/audio_latency.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/logging.h"
|
| #include "base/time/time.h"
|
| #include "build/build_config.h"
|
| +#include "media/base/limits.h"
|
|
|
| namespace media {
|
|
|
| @@ -132,6 +133,12 @@ int AudioLatency::GetExactBufferSize(base::TimeDelta duration,
|
| int hardware_buffer_size) {
|
| const double requested_buffer_size = duration.InSecondsF() * sample_rate;
|
|
|
| + // On OSX the preferred buffer size is larger than the minimum, however we
|
| + // allow values down to the minimum if requested explicitly.
|
| +#if defined(OS_MACOSX)
|
| + hardware_buffer_size = limits::kMinimumOutputBufferSize;
|
| +#endif
|
| +
|
| DCHECK_NE(0, hardware_buffer_size);
|
|
|
| // Round the requested size to the nearest multiple of the hardware size
|
| @@ -139,7 +146,8 @@ int AudioLatency::GetExactBufferSize(base::TimeDelta duration,
|
| std::round(std::max(requested_buffer_size, 1.0) / hardware_buffer_size) *
|
| hardware_buffer_size;
|
|
|
| - return std::max(buffer_size, hardware_buffer_size);
|
| + return std::min(static_cast<int>(media::limits::kMaximumOutputBufferSize),
|
| + std::max(buffer_size, hardware_buffer_size));
|
| }
|
|
|
| } // namespace media
|
|
|