Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1015)

Unified Diff: media/base/mac/audio_latency_mac.cc

Issue 2908073002: Make OS audio buffer size limits visible. (Closed)
Patch Set: Remove pulse-related changes. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/mac/audio_latency_mac.h ('k') | third_party/WebKit/Source/platform/audio/AudioDestination.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/mac/audio_latency_mac.cc
diff --git a/media/base/mac/audio_latency_mac.cc b/media/base/mac/audio_latency_mac.cc
new file mode 100644
index 0000000000000000000000000000000000000000..223e3ad87a208c972605eb1953f307c48594712c
--- /dev/null
+++ b/media/base/mac/audio_latency_mac.cc
@@ -0,0 +1,23 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/mac/audio_latency_mac.h"
+#include "media/base/limits.h"
+
+namespace media {
+
+int GetMinAudioBufferSizeMacOS(int min_buffer_size, int sample_rate) {
+ int buffer_size = min_buffer_size;
+ if (sample_rate > 48000) {
+ // The default buffer size is too small for higher sample rates and may lead
+ // to glitching. Adjust upwards by multiples of the default size.
+ if (sample_rate <= 96000)
+ buffer_size = 2 * limits::kMinAudioBufferSize;
+ else if (sample_rate <= 192000)
+ buffer_size = 4 * limits::kMinAudioBufferSize;
+ }
+ return buffer_size;
+}
+
+} // namespace media
« no previous file with comments | « media/base/mac/audio_latency_mac.h ('k') | third_party/WebKit/Source/platform/audio/AudioDestination.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698