| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 audio_input->audio_buffer_list(), | 476 audio_input->audio_buffer_list(), |
| 477 time_stamp); | 477 time_stamp); |
| 478 } | 478 } |
| 479 | 479 |
| 480 OSStatus AUAudioInputStream::Provide(UInt32 number_of_frames, | 480 OSStatus AUAudioInputStream::Provide(UInt32 number_of_frames, |
| 481 AudioBufferList* io_data, | 481 AudioBufferList* io_data, |
| 482 const AudioTimeStamp* time_stamp) { | 482 const AudioTimeStamp* time_stamp) { |
| 483 // Update the capture latency. | 483 // Update the capture latency. |
| 484 double capture_latency_frames = GetCaptureLatency(time_stamp); | 484 double capture_latency_frames = GetCaptureLatency(time_stamp); |
| 485 | 485 |
| 486 // Update the AGC volume level once every second. Note that, |volume| is | 486 // The AGC volume level is updated once every second on a separate thread. |
| 487 // also updated each time SetVolume() is called through IPC by the | 487 // Note that, |volume| is also updated each time SetVolume() is called |
| 488 // render-side AGC. | 488 // through IPC by the render-side AGC. |
| 489 double normalized_volume = 0.0; | 489 double normalized_volume = 0.0; |
| 490 QueryAgcVolume(&normalized_volume); | 490 GetAgcVolume(&normalized_volume); |
| 491 | 491 |
| 492 AudioBuffer& buffer = io_data->mBuffers[0]; | 492 AudioBuffer& buffer = io_data->mBuffers[0]; |
| 493 uint8* audio_data = reinterpret_cast<uint8*>(buffer.mData); | 493 uint8* audio_data = reinterpret_cast<uint8*>(buffer.mData); |
| 494 uint32 capture_delay_bytes = static_cast<uint32> | 494 uint32 capture_delay_bytes = static_cast<uint32> |
| 495 ((capture_latency_frames + 0.5) * format_.mBytesPerFrame); | 495 ((capture_latency_frames + 0.5) * format_.mBytesPerFrame); |
| 496 DCHECK(audio_data); | 496 DCHECK(audio_data); |
| 497 if (!audio_data) | 497 if (!audio_data) |
| 498 return kAudioUnitErr_InvalidElement; | 498 return kAudioUnitErr_InvalidElement; |
| 499 | 499 |
| 500 // Accumulate captured audio in FIFO until we can match the output size | 500 // Accumulate captured audio in FIFO until we can match the output size |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 kAudioDevicePropertyScopeInput, | 650 kAudioDevicePropertyScopeInput, |
| 651 static_cast<UInt32>(channel) | 651 static_cast<UInt32>(channel) |
| 652 }; | 652 }; |
| 653 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, | 653 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, |
| 654 &property_address, | 654 &property_address, |
| 655 &is_settable); | 655 &is_settable); |
| 656 return (result == noErr) ? is_settable : false; | 656 return (result == noErr) ? is_settable : false; |
| 657 } | 657 } |
| 658 | 658 |
| 659 } // namespace media | 659 } // namespace media |
| OLD | NEW |