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

Unified Diff: webrtc/modules/audio_device/mac/audio_device_mac.cc

Issue 2103863004: UMA log for audio_device Init and Start(Playout|Recording). Make Init return a more specific error … (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rename variable. Created 4 years, 6 months 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
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..70236b8837df9efead7bffbbdc6673e02a1e3d3f 100644
--- a/webrtc/modules/audio_device/mac/audio_device_mac.cc
+++ b/webrtc/modules/audio_device/mac/audio_device_mac.cc
@@ -10,6 +10,7 @@
#include "webrtc/base/arraysize.h"
#include "webrtc/base/checks.h"
+#include "webrtc/base/logging.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/modules/audio_device/audio_device_config.h"
#include "webrtc/modules/audio_device/mac/audio_device_mac.h"
@@ -221,11 +222,11 @@ int32_t AudioDeviceMac::ActiveAudioLayer(
return 0;
}
-int32_t AudioDeviceMac::Init() {
+AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() {
CriticalSectionScoped lock(&_critSect);
if (_initialized) {
- return 0;
+ return InitStatus::OK;
}
OSStatus err = noErr;
@@ -250,7 +251,7 @@ int32_t AudioDeviceMac::Init() {
if (bufSize == -1) {
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
" PaUtil_InitializeRingBuffer() error");
- return -1;
+ return InitStatus::PLAYOUT_ERROR;
}
}
@@ -272,7 +273,7 @@ int32_t AudioDeviceMac::Init() {
if (bufSize == -1) {
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
" PaUtil_InitializeRingBuffer() error");
- return -1;
+ return InitStatus::RECORDING_ERROR;
}
}
@@ -282,7 +283,7 @@ int32_t AudioDeviceMac::Init() {
if (kernErr != KERN_SUCCESS) {
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
" semaphore_create() error: %d", kernErr);
- return -1;
+ return InitStatus::OTHER_ERROR;
}
kernErr = semaphore_create(mach_task_self(), &_captureSemaphore,
@@ -290,7 +291,7 @@ int32_t AudioDeviceMac::Init() {
if (kernErr != KERN_SUCCESS) {
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
" semaphore_create() error: %d", kernErr);
- return -1;
+ return InitStatus::OTHER_ERROR;
}
// Setting RunLoop to NULL here instructs HAL to manage its own thread for
@@ -302,8 +303,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) {
+ LOG(LS_ERROR) << "Error in AudioObjectSetPropertyData: "
+ << (const char*)&aoerr;
+ return InitStatus::OTHER_ERROR;
+ }
// Listen for any device changes.
propertyAddress.mSelector = kAudioHardwarePropertyDevices;
@@ -338,7 +344,7 @@ int32_t AudioDeviceMac::Init() {
_initialized = true;
- return 0;
+ return InitStatus::OK;
}
int32_t AudioDeviceMac::Terminate() {

Powered by Google App Engine
This is Rietveld 408576698