Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(709)

Unified Diff: media/audio/mac/audio_low_latency_input_mac.cc

Issue 1551613002: Initialize input AUHAL before using it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698