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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 return kAudioUnitErr_InvalidElement; | 506 return kAudioUnitErr_InvalidElement; |
507 | 507 |
508 // Accumulate captured audio in FIFO until we can match the output size | 508 // Accumulate captured audio in FIFO until we can match the output size |
509 // requested by the client. | 509 // requested by the client. |
510 fifo_->Append(audio_data, buffer.mDataByteSize); | 510 fifo_->Append(audio_data, buffer.mDataByteSize); |
511 | 511 |
512 // Deliver recorded data to the client as soon as the FIFO contains a | 512 // Deliver recorded data to the client as soon as the FIFO contains a |
513 // sufficient amount. | 513 // sufficient amount. |
514 if (fifo_->forward_bytes() >= requested_size_bytes_) { | 514 if (fifo_->forward_bytes() >= requested_size_bytes_) { |
515 // Read from FIFO into temporary data buffer. | 515 // Read from FIFO into temporary data buffer. |
516 fifo_->Read(data_->GetWritableData(), requested_size_bytes_); | 516 fifo_->Read(data_->writable_data(), requested_size_bytes_); |
517 | 517 |
518 // Deliver data packet, delay estimation and volume level to the user. | 518 // Deliver data packet, delay estimation and volume level to the user. |
519 sink_->OnData(this, | 519 sink_->OnData(this, |
520 data_->GetData(), | 520 data_->data(), |
521 requested_size_bytes_, | 521 requested_size_bytes_, |
522 capture_delay_bytes, | 522 capture_delay_bytes, |
523 normalized_volume); | 523 normalized_volume); |
524 } | 524 } |
525 | 525 |
526 return noErr; | 526 return noErr; |
527 } | 527 } |
528 | 528 |
529 int AUAudioInputStream::HardwareSampleRate() { | 529 int AUAudioInputStream::HardwareSampleRate() { |
530 // Determine the default input device's sample-rate. | 530 // Determine the default input device's sample-rate. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 kAudioDevicePropertyScopeInput, | 655 kAudioDevicePropertyScopeInput, |
656 static_cast<UInt32>(channel) | 656 static_cast<UInt32>(channel) |
657 }; | 657 }; |
658 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, | 658 OSStatus result = AudioObjectIsPropertySettable(input_device_id_, |
659 &property_address, | 659 &property_address, |
660 &is_settable); | 660 &is_settable); |
661 return (result == noErr) ? is_settable : false; | 661 return (result == noErr) ? is_settable : false; |
662 } | 662 } |
663 | 663 |
664 } // namespace media | 664 } // namespace media |
OLD | NEW |