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