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

Unified Diff: media/audio/mac/audio_manager_mac.cc

Issue 673183002: Increase the default buffer size from 128 to 256 on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated the comment. Created 6 years, 2 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/audio/mac/audio_manager_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_manager_mac.cc
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index b6ecf174ba9ccaae51d30b30fc13276706e6af92..b8416d291df50c5434b7c963b33397f8f39d82b4 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -717,17 +717,25 @@ void AudioManagerMac::HandleDeviceChanges() {
NotifyAllOutputDeviceChangeListeners();
}
-int AudioManagerMac::ChooseBufferSize(int output_sample_rate) {
- int buffer_size = kMinimumInputOutputBufferSize;
+int AudioManagerMac::ChooseBufferSize(bool is_input, int sample_rate) {
+ // kMinimumInputOutputBufferSize is too small for the output side because
+ // CoreAudio can get into under-run if the renderer fails delivering data
+ // to the browser within the allowed time by the OS. The workaround is to
+ // use 256 samples as the default output buffer size for sample rates
+ // smaller than 96KHz.
+ // TODO(xians): Remove this workaround after WebAudio supports user defined
+ // buffer size.
DaleCurtis 2014/10/24 17:04:43 Link to tracking bug?
no longer working on chromium 2014/10/27 10:58:51 Done.
+ int buffer_size = is_input ?
no longer working on chromium 2014/10/24 10:05:29 Dale, for the input side, we still want 128 sample
+ kMinimumInputOutputBufferSize : 2 * kMinimumInputOutputBufferSize;
const int user_buffer_size = GetUserBufferSize();
if (user_buffer_size) {
buffer_size = user_buffer_size;
- } else if (output_sample_rate > 48000) {
+ } else 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 (output_sample_rate <= 96000)
+ if (sample_rate <= 96000)
buffer_size = 2 * kMinimumInputOutputBufferSize;
- else if (output_sample_rate <= 192000)
+ else if (sample_rate <= 192000)
buffer_size = 4 * kMinimumInputOutputBufferSize;
}
« no previous file with comments | « media/audio/mac/audio_manager_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698