| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (requested_size_frames < number_of_frames_) { | 94 if (requested_size_frames < number_of_frames_) { |
| 95 // For devices that only support a low sample rate like 8kHz, we adjust the | 95 // For devices that only support a low sample rate like 8kHz, we adjust the |
| 96 // buffer size to match number_of_frames_. The value of number_of_frames_ | 96 // buffer size to match number_of_frames_. The value of number_of_frames_ |
| 97 // in this case has not been calculated based on hardware settings but | 97 // in this case has not been calculated based on hardware settings but |
| 98 // rather our hardcoded defaults (see ChooseBufferSize). | 98 // rather our hardcoded defaults (see ChooseBufferSize). |
| 99 requested_size_frames = number_of_frames_; | 99 requested_size_frames = number_of_frames_; |
| 100 } | 100 } |
| 101 | 101 |
| 102 requested_size_bytes_ = requested_size_frames * format_.mBytesPerFrame; | 102 requested_size_bytes_ = requested_size_frames * format_.mBytesPerFrame; |
| 103 DVLOG(1) << "Requested buffer size in bytes : " << requested_size_bytes_; | 103 DVLOG(1) << "Requested buffer size in bytes : " << requested_size_bytes_; |
| 104 DLOG_IF(INFO, requested_size_frames > number_of_frames_) << "FIFO is used"; | 104 DVLOG_IF(0, requested_size_frames > number_of_frames_) << "FIFO is used"; |
| 105 | 105 |
| 106 const int number_of_bytes = number_of_frames_ * format_.mBytesPerFrame; | 106 const int number_of_bytes = number_of_frames_ * format_.mBytesPerFrame; |
| 107 fifo_delay_bytes_ = requested_size_bytes_ - number_of_bytes; | 107 fifo_delay_bytes_ = requested_size_bytes_ - number_of_bytes; |
| 108 | 108 |
| 109 // Allocate some extra memory to avoid memory reallocations. | 109 // Allocate some extra memory to avoid memory reallocations. |
| 110 // Ensure that the size is an even multiple of |number_of_frames_ and | 110 // Ensure that the size is an even multiple of |number_of_frames_ and |
| 111 // larger than |requested_size_frames|. | 111 // larger than |requested_size_frames|. |
| 112 // Example: number_of_frames_=128, requested_size_frames=480 => | 112 // Example: number_of_frames_=128, requested_size_frames=480 => |
| 113 // allocated space equals 4*128=512 audio frames | 113 // allocated space equals 4*128=512 audio frames |
| 114 const int max_forward_capacity = number_of_bytes * | 114 const int max_forward_capacity = number_of_bytes * |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 kAudioDevicePropertyScopeInput, | 658 kAudioDevicePropertyScopeInput, |
| 659 static_cast<UInt32>(channel) | 659 static_cast<UInt32>(channel) |
| 660 }; | 660 }; |
| 661 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, | 661 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, |
| 662 &property_address, | 662 &property_address, |
| 663 &is_settable); | 663 &is_settable); |
| 664 return (result == noErr) ? is_settable : false; | 664 return (result == noErr) ? is_settable : false; |
| 665 } | 665 } |
| 666 | 666 |
| 667 } // namespace media | 667 } // namespace media |
| OLD | NEW |