| 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" |
| 11 #include "base/mac/mac_logging.h" | 11 #include "base/mac/mac_logging.h" |
| 12 #include "base/metrics/sparse_histogram.h" | |
| 13 #include "media/audio/mac/audio_manager_mac.h" | 12 #include "media/audio/mac/audio_manager_mac.h" |
| 14 #include "media/base/audio_bus.h" | 13 #include "media/base/audio_bus.h" |
| 15 #include "media/base/data_buffer.h" | 14 #include "media/base/data_buffer.h" |
| 16 | 15 |
| 17 namespace media { | 16 namespace media { |
| 18 | 17 |
| 19 // Number of blocks of buffers used in the |fifo_|. | 18 // Number of blocks of buffers used in the |fifo_|. |
| 20 const int kNumberOfBlocksBufferInFifo = 2; | 19 const int kNumberOfBlocksBufferInFifo = 2; |
| 21 | 20 |
| 22 static std::ostream& operator<<(std::ostream& os, | 21 static std::ostream& operator<<(std::ostream& os, |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 if (!audio_input) | 489 if (!audio_input) |
| 491 return kAudioUnitErr_InvalidElement; | 490 return kAudioUnitErr_InvalidElement; |
| 492 | 491 |
| 493 // Receive audio from the AUHAL from the output scope of the Audio Unit. | 492 // Receive audio from the AUHAL from the output scope of the Audio Unit. |
| 494 OSStatus result = AudioUnitRender(audio_input->audio_unit(), | 493 OSStatus result = AudioUnitRender(audio_input->audio_unit(), |
| 495 flags, | 494 flags, |
| 496 time_stamp, | 495 time_stamp, |
| 497 bus_number, | 496 bus_number, |
| 498 number_of_frames, | 497 number_of_frames, |
| 499 audio_input->audio_buffer_list()); | 498 audio_input->audio_buffer_list()); |
| 500 if (result) { | 499 if (result) |
| 501 UMA_HISTOGRAM_SPARSE_SLOWLY("Media.AudioInputCbErrorMac", result); | |
| 502 NOTREACHED(); | |
| 503 return result; | 500 return result; |
| 504 } | |
| 505 | 501 |
| 506 // Deliver recorded data to the consumer as a callback. | 502 // Deliver recorded data to the consumer as a callback. |
| 507 return audio_input->Provide(number_of_frames, | 503 return audio_input->Provide(number_of_frames, |
| 508 audio_input->audio_buffer_list(), | 504 audio_input->audio_buffer_list(), |
| 509 time_stamp); | 505 time_stamp); |
| 510 } | 506 } |
| 511 | 507 |
| 512 OSStatus AUAudioInputStream::Provide(UInt32 number_of_frames, | 508 OSStatus AUAudioInputStream::Provide(UInt32 number_of_frames, |
| 513 AudioBufferList* io_data, | 509 AudioBufferList* io_data, |
| 514 const AudioTimeStamp* time_stamp) { | 510 const AudioTimeStamp* time_stamp) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 kAudioDevicePropertyScopeInput, | 670 kAudioDevicePropertyScopeInput, |
| 675 static_cast<UInt32>(channel) | 671 static_cast<UInt32>(channel) |
| 676 }; | 672 }; |
| 677 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, | 673 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, |
| 678 &property_address, | 674 &property_address, |
| 679 &is_settable); | 675 &is_settable); |
| 680 return (result == noErr) ? is_settable : false; | 676 return (result == noErr) ? is_settable : false; |
| 681 } | 677 } |
| 682 | 678 |
| 683 } // namespace media | 679 } // namespace media |
| OLD | NEW |