| 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_manager_mac.h" | 5 #include "media/audio/mac/audio_manager_mac.h" |
| 6 | 6 |
| 7 | |
| 8 #include "base/bind.h" | 7 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 10 #include "base/mac/mac_logging.h" | 9 #include "base/mac/mac_logging.h" |
| 11 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/power_monitor/power_monitor.h" | 11 #include "base/power_monitor/power_monitor.h" |
| 13 #include "base/power_monitor/power_observer.h" | 12 #include "base/power_monitor/power_observer.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 16 #include "media/audio/audio_parameters.h" | 15 #include "media/audio/audio_parameters.h" |
| 17 #include "media/audio/mac/audio_auhal_mac.h" | 16 #include "media/audio/mac/audio_auhal_mac.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 pa.mSelector = kAudioDevicePropertyStreamConfiguration; | 421 pa.mSelector = kAudioDevicePropertyStreamConfiguration; |
| 423 pa.mScope = scope; | 422 pa.mScope = scope; |
| 424 pa.mElement = kAudioObjectPropertyElementMaster; | 423 pa.mElement = kAudioObjectPropertyElementMaster; |
| 425 | 424 |
| 426 UInt32 size; | 425 UInt32 size; |
| 427 OSStatus result = AudioObjectGetPropertyDataSize(device, &pa, 0, 0, &size); | 426 OSStatus result = AudioObjectGetPropertyDataSize(device, &pa, 0, 0, &size); |
| 428 if (result != noErr || !size) | 427 if (result != noErr || !size) |
| 429 return false; | 428 return false; |
| 430 | 429 |
| 431 // Allocate storage. | 430 // Allocate storage. |
| 432 scoped_ptr<uint8[]> list_storage(new uint8[size]); | 431 scoped_ptr<uint8_t[]> list_storage(new uint8_t[size]); |
| 433 AudioBufferList& buffer_list = | 432 AudioBufferList& buffer_list = |
| 434 *reinterpret_cast<AudioBufferList*>(list_storage.get()); | 433 *reinterpret_cast<AudioBufferList*>(list_storage.get()); |
| 435 | 434 |
| 436 result = AudioObjectGetPropertyData(device, &pa, 0, 0, &size, &buffer_list); | 435 result = AudioObjectGetPropertyData(device, &pa, 0, 0, &size, &buffer_list); |
| 437 if (result != noErr) | 436 if (result != noErr) |
| 438 return false; | 437 return false; |
| 439 | 438 |
| 440 // Determine number of input channels. | 439 // Determine number of input channels. |
| 441 int channels_per_frame = buffer_list.mNumberBuffers > 0 ? | 440 int channels_per_frame = buffer_list.mNumberBuffers > 0 ? |
| 442 buffer_list.mBuffers[0].mNumberChannels : 0; | 441 buffer_list.mBuffers[0].mNumberChannels : 0; |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 basic_input_streams_.erase(stream_it); | 900 basic_input_streams_.erase(stream_it); |
| 902 | 901 |
| 903 AudioManagerBase::ReleaseInputStream(stream); | 902 AudioManagerBase::ReleaseInputStream(stream); |
| 904 } | 903 } |
| 905 | 904 |
| 906 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 905 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
| 907 return new AudioManagerMac(audio_log_factory); | 906 return new AudioManagerMac(audio_log_factory); |
| 908 } | 907 } |
| 909 | 908 |
| 910 } // namespace media | 909 } // namespace media |
| OLD | NEW |