Index: webrtc/modules/audio_device/mac/audio_device_mac.cc |
diff --git a/webrtc/modules/audio_device/mac/audio_device_mac.cc b/webrtc/modules/audio_device/mac/audio_device_mac.cc |
index 0f33d1124deea786b1407133942e8b36bf978ae7..29a95a093a58375f238b557ee2059f842884e41a 100644 |
--- a/webrtc/modules/audio_device/mac/audio_device_mac.cc |
+++ b/webrtc/modules/audio_device/mac/audio_device_mac.cc |
@@ -221,11 +221,11 @@ int32_t AudioDeviceMac::ActiveAudioLayer( |
return 0; |
} |
-int32_t AudioDeviceMac::Init() { |
+AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() { |
CriticalSectionScoped lock(&_critSect); |
if (_initialized) { |
- return 0; |
+ return InitStatus::kOk; |
} |
OSStatus err = noErr; |
@@ -250,7 +250,7 @@ int32_t AudioDeviceMac::Init() { |
if (bufSize == -1) { |
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, |
" PaUtil_InitializeRingBuffer() error"); |
- return -1; |
+ return InitStatus::kPlayoutError; |
} |
} |
@@ -272,7 +272,7 @@ int32_t AudioDeviceMac::Init() { |
if (bufSize == -1) { |
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, |
" PaUtil_InitializeRingBuffer() error"); |
- return -1; |
+ return InitStatus::kRecordingError; |
} |
} |
@@ -282,7 +282,7 @@ int32_t AudioDeviceMac::Init() { |
if (kernErr != KERN_SUCCESS) { |
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, |
" semaphore_create() error: %d", kernErr); |
- return -1; |
+ return InitStatus::kOtherError; |
} |
kernErr = semaphore_create(mach_task_self(), &_captureSemaphore, |
@@ -290,7 +290,7 @@ int32_t AudioDeviceMac::Init() { |
if (kernErr != KERN_SUCCESS) { |
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, |
" semaphore_create() error: %d", kernErr); |
- return -1; |
+ return InitStatus::kOtherError; |
} |
// Setting RunLoop to NULL here instructs HAL to manage its own thread for |
@@ -302,8 +302,13 @@ int32_t AudioDeviceMac::Init() { |
kAudioObjectPropertyElementMaster}; |
CFRunLoopRef runLoop = NULL; |
UInt32 size = sizeof(CFRunLoopRef); |
- WEBRTC_CA_RETURN_ON_ERR(AudioObjectSetPropertyData( |
- kAudioObjectSystemObject, &propertyAddress, 0, NULL, size, &runLoop)); |
+ int aoerr = AudioObjectSetPropertyData( |
+ kAudioObjectSystemObject, &propertyAddress, 0, NULL, size, &runLoop); |
+ if (aoerr != noErr) { |
+ logCAMsg(kTraceError, kTraceAudioDevice, _id, |
+ "Error in AudioObjectSetPropertyData", (const char*)&aoerr); |
+ return InitStatus::kOtherError; |
+ } |
// Listen for any device changes. |
propertyAddress.mSelector = kAudioHardwarePropertyDevices; |
@@ -338,7 +343,7 @@ int32_t AudioDeviceMac::Init() { |
_initialized = true; |
- return 0; |
+ return InitStatus::kOk; |
} |
int32_t AudioDeviceMac::Terminate() { |