Chromium Code Reviews| Index: media/audio/mac/audio_low_latency_input_mac.cc |
| diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc |
| index 34defaed376450c1dc1a4b64a1ce8075769e901c..b81c4900069b370ee63cba0cabc8f2c6bc2c061e 100644 |
| --- a/media/audio/mac/audio_low_latency_input_mac.cc |
| +++ b/media/audio/mac/audio_low_latency_input_mac.cc |
| @@ -79,7 +79,7 @@ AUAudioInputStream::AUAudioInputStream(AudioManagerMac* manager, |
| format_.mBytesPerFrame = format_.mBytesPerPacket; |
| format_.mReserved = 0; |
| - DVLOG(1) << "Desired ouput format: " << format_; |
| + DVLOG(1) << "Desired output (client side) format: " << format_; |
| // Derive size (in bytes) of the buffers that we will render to. |
| UInt32 data_byte_size = number_of_frames_ * format_.mBytesPerFrame; |
| @@ -134,6 +134,10 @@ bool AUAudioInputStream::Open() { |
| // Obtain an AudioOuputUnit using an AUHAL component description. |
| // Description for the Audio Unit we want to use (AUHAL in this case). |
| + // The kAudioUnitSubType_HALOutput audio unit interfaces to any audio device. |
| + // The user specifies which audio device to track. The audio unit can do |
|
tommi (sloooow) - chröme
2015/12/28 18:49:50
Nit:spacing
henrika (OOO until Aug 14)
2015/12/29 09:32:25
My bad; hope it is OK if I skip uploading a fix fo
|
| + // input from the device as well as output to the device. Bus 0 is used for |
| + // the output side, bus 1 is used to get audio input from the device. |
| AudioComponentDescription desc = { |
| kAudioUnitType_Output, |
| kAudioUnitSubType_HALOutput, |
| @@ -142,7 +146,7 @@ bool AUAudioInputStream::Open() { |
| 0 |
| }; |
| - AudioComponent comp = AudioComponentFindNext(0, &desc); |
| + AudioComponent comp = AudioComponentFindNext(NULL, &desc); |
| DCHECK(comp); |
| // Get access to the service provided by the specified Audio Unit. |
| @@ -152,6 +156,13 @@ bool AUAudioInputStream::Open() { |
| return false; |
| } |
| + // Initialize the AUHAL before making any changes or using it. |
| + result = AudioUnitInitialize(audio_unit_); |
| + if (result != noErr) { |
| + HandleError(result); |
| + return false; |
| + } |
| + |
| // Enable IO on the input scope of the Audio Unit. |
| // After creating the AUHAL object, we must enable IO on the input scope |