OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/audio/mac/audio_low_latency_input_mac.h" | 5 #include "media/audio/mac/audio_low_latency_input_mac.h" |
6 | 6 |
7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 kAudioUnitScope_Output, | 188 kAudioUnitScope_Output, |
189 1, | 189 1, |
190 &format_, | 190 &format_, |
191 sizeof(format_)); | 191 sizeof(format_)); |
192 if (result) { | 192 if (result) { |
193 HandleError(result); | 193 HandleError(result); |
194 return false; | 194 return false; |
195 } | 195 } |
196 | 196 |
197 // Set the desired number of frames in the IO buffer (output scope). | 197 // Set the desired number of frames in the IO buffer (output scope). |
| 198 // WARNING: Setting this value changes the frame size for all audio units in |
| 199 // the current process. It's imperative that the input and output frame sizes |
| 200 // be the same as audio_util::GetAudioHardwareBufferSize(). |
| 201 // TODO(henrika): Due to http://crrev.com/159666 this is currently not true |
| 202 // and should be fixed, a CHECK() should be added at that time. |
198 result = AudioUnitSetProperty(audio_unit_, | 203 result = AudioUnitSetProperty(audio_unit_, |
199 kAudioDevicePropertyBufferFrameSize, | 204 kAudioDevicePropertyBufferFrameSize, |
200 kAudioUnitScope_Output, | 205 kAudioUnitScope_Output, |
201 1, | 206 1, |
202 &number_of_frames_, // size is set in the ctor | 207 &number_of_frames_, // size is set in the ctor |
203 sizeof(number_of_frames_)); | 208 sizeof(number_of_frames_)); |
204 if (result) { | 209 if (result) { |
205 HandleError(result); | 210 HandleError(result); |
206 return false; | 211 return false; |
207 } | 212 } |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 kAudioDevicePropertyScopeInput, | 606 kAudioDevicePropertyScopeInput, |
602 static_cast<UInt32>(channel) | 607 static_cast<UInt32>(channel) |
603 }; | 608 }; |
604 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, | 609 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, |
605 &property_address, | 610 &property_address, |
606 &is_settable); | 611 &is_settable); |
607 return (result == noErr) ? is_settable : false; | 612 return (result == noErr) ? is_settable : false; |
608 } | 613 } |
609 | 614 |
610 } // namespace media | 615 } // namespace media |
OLD | NEW |