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

Side by Side Diff: media/base/mac/audio_util_mac.cc

Issue 2908073002: Make OS audio buffer size limits visible. (Closed)
Patch Set: Updates based on reviewer feedback. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 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_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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698