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

Side by Side Diff: media/base/audio_hardware_config.cc

Issue 236123002: Allow pass through buffer sizes on OSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Rebase. Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/audio_hardware_config.h" 5 #include "media/base/audio_hardware_config.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 11
12 using base::AutoLock; 12 using base::AutoLock;
13 using media::AudioParameters; 13 using media::AudioParameters;
14 14
15 namespace media { 15 namespace media {
16 16
17 #if defined(OS_LINUX) 17 #if defined(OS_LINUX) || defined(OS_MACOSX)
18 #define HIGH_LATENCY_AUDIO_SUPPORT 1 18 #define HIGH_LATENCY_AUDIO_SUPPORT 1
19 #endif 19 #endif
20 20
21 #if defined(HIGH_LATENCY_AUDIO_SUPPORT) 21 #if defined(HIGH_LATENCY_AUDIO_SUPPORT)
22 // Taken from "Bit Twiddling Hacks" 22 // Taken from "Bit Twiddling Hacks"
23 // http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 23 // http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
24 static uint32_t RoundUpToPowerOfTwo(uint32_t v) { 24 static uint32_t RoundUpToPowerOfTwo(uint32_t v) {
25 v--; 25 v--;
26 v |= v >> 1; 26 v |= v >> 1;
27 v |= v >> 2; 27 v |= v >> 2;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // dependent but will generally be sample_rate() / 100. 119 // dependent but will generally be sample_rate() / 100.
120 const int high_latency_buffer_size = 120 const int high_latency_buffer_size =
121 RoundUpToPowerOfTwo(2 * output_params_.sample_rate() / 100); 121 RoundUpToPowerOfTwo(2 * output_params_.sample_rate() / 100);
122 return std::max(output_params_.frames_per_buffer(), high_latency_buffer_size); 122 return std::max(output_params_.frames_per_buffer(), high_latency_buffer_size);
123 #else 123 #else
124 return output_params_.frames_per_buffer(); 124 return output_params_.frames_per_buffer();
125 #endif 125 #endif
126 } 126 }
127 127
128 } // namespace media 128 } // namespace media
OLDNEW
« media/audio/mac/audio_low_latency_input_mac.cc ('K') | « media/audio/mac/audio_manager_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698