summaryrefslogtreecommitdiffstats
path: root/media/audio/mac
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 23:06:49 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 23:06:49 +0000
commit33b9820a5039e8a9925ddc0ebaced8f50112ce3b (patch)
treefc66820a0ea13d0160dfb3253028cb8a1d3b468f /media/audio/mac
parent1797640037e0127eb5f47bc60dc94b78a2b904b5 (diff)
downloadchromium_src-33b9820a5039e8a9925ddc0ebaced8f50112ce3b.zip
chromium_src-33b9820a5039e8a9925ddc0ebaced8f50112ce3b.tar.gz
chromium_src-33b9820a5039e8a9925ddc0ebaced8f50112ce3b.tar.bz2
Add OSSTATUS_LOG API.
Review URL: https://chromiumcodereview.appspot.com/9235084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/mac')
-rw-r--r--media/audio/mac/audio_input_mac.cc7
-rw-r--r--media/audio/mac/audio_low_latency_input_mac.cc20
-rw-r--r--media/audio/mac/audio_low_latency_output_mac.cc30
-rw-r--r--media/audio/mac/audio_manager_mac.cc7
-rw-r--r--media/audio/mac/audio_output_mac.cc7
5 files changed, 42 insertions, 29 deletions
diff --git a/media/audio/mac/audio_input_mac.cc b/media/audio/mac/audio_input_mac.cc
index eb6f167..67e5ed5 100644
--- a/media/audio/mac/audio_input_mac.cc
+++ b/media/audio/mac/audio_input_mac.cc
@@ -1,9 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/audio/mac/audio_input_mac.h"
+#include <CoreServices/CoreServices.h>
+
#include "base/basictypes.h"
#include "base/logging.h"
#include "media/audio/audio_util.h"
@@ -114,7 +116,8 @@ void PCMQueueInAudioInputStream::Close() {
void PCMQueueInAudioInputStream::HandleError(OSStatus err) {
if (callback_)
callback_->OnError(this, static_cast<int>(err));
- NOTREACHED() << "error code " << err;
+ NOTREACHED() << "error " << GetMacOSStatusErrorString(err)
+ << " (" << err << ")";
}
bool PCMQueueInAudioInputStream::SetupBuffers() {
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index bd534e1..ec97fe9 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "media/audio/audio_util.h"
#include "media/audio/mac/audio_manager_mac.h"
@@ -223,18 +224,19 @@ void AUAudioInputStream::Start(AudioInputCallback* callback) {
if (result == noErr) {
started_ = true;
}
- DLOG_IF(ERROR, result != noErr) << "Failed to start acquiring data";
+ OSSTATUS_DLOG_IF(ERROR, result != noErr, result)
+ << "Failed to start acquiring data";
}
void AUAudioInputStream::Stop() {
if (!started_)
return;
- OSStatus result;
- result = AudioOutputUnitStop(audio_unit_);
+ OSStatus result = AudioOutputUnitStop(audio_unit_);
if (result == noErr) {
started_ = false;
}
- DLOG_IF(ERROR, result != noErr) << "Failed to stop acquiring data";
+ OSSTATUS_DLOG_IF(ERROR, result != noErr, result)
+ << "Failed to stop acquiring data";
}
void AUAudioInputStream::Close() {
@@ -327,7 +329,7 @@ double AUAudioInputStream::HardwareSampleRate() {
0,
&info_size,
&device_id);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return 0.0;
@@ -367,7 +369,8 @@ double AUAudioInputStream::GetHardwareLatency() {
0,
&audio_unit_latency_sec,
&size);
- DLOG_IF(WARNING, result != noErr) << "Could not get audio unit latency.";
+ OSSTATUS_DLOG_IF(WARNING, result != noErr, result)
+ << "Could not get audio unit latency";
// Get input audio device latency.
AudioObjectPropertyAddress property_address = {
@@ -436,7 +439,8 @@ double AUAudioInputStream::GetCaptureLatency(
}
void AUAudioInputStream::HandleError(OSStatus err) {
- NOTREACHED() << "error code: " << err;
+ NOTREACHED() << "error " << GetMacOSStatusErrorString(err)
+ << " (" << err << ")";
if (sink_)
sink_->OnError(this, static_cast<int>(err));
}
diff --git a/media/audio/mac/audio_low_latency_output_mac.cc b/media/audio/mac/audio_low_latency_output_mac.cc
index a304c64..f600e5f 100644
--- a/media/audio/mac/audio_low_latency_output_mac.cc
+++ b/media/audio/mac/audio_low_latency_output_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/mac/mac_logging.h"
#include "media/audio/audio_util.h"
#include "media/audio/mac/audio_manager_mac.h"
@@ -87,7 +88,7 @@ bool AUAudioOutputStream::Open() {
0,
&size,
&output_device_id_);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -104,13 +105,12 @@ bool AUAudioOutputStream::Open() {
DCHECK(comp);
result = OpenAComponent(comp, &output_unit_);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
result = AudioUnitInitialize(output_unit_);
-
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -131,8 +131,7 @@ bool AUAudioOutputStream::Configure() {
0,
&input,
sizeof(input));
-
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -144,7 +143,7 @@ bool AUAudioOutputStream::Configure() {
0,
&format_,
sizeof(format_));
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -157,7 +156,7 @@ bool AUAudioOutputStream::Configure() {
0,
&buffer_size,
sizeof(buffer_size));
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return false;
@@ -269,7 +268,7 @@ double AUAudioOutputStream::HardwareSampleRate() {
0,
&info_size,
&device_id);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return 0.0; // error
@@ -287,7 +286,7 @@ double AUAudioOutputStream::HardwareSampleRate() {
0,
&info_size,
&nominal_sample_rate);
- DCHECK_EQ(result, 0);
+ OSSTATUS_DCHECK(result == noErr, result);
if (result)
return 0.0; // error
@@ -309,7 +308,8 @@ double AUAudioOutputStream::GetHardwareLatency() {
0,
&audio_unit_latency_sec,
&size);
- DLOG_IF(WARNING, result != noErr) << "Could not get audio unit latency.";
+ OSSTATUS_DLOG_IF(WARNING, result != noErr, result)
+ << "Could not get audio unit latency";
// Get output audio device latency.
AudioObjectPropertyAddress property_address = {
@@ -325,7 +325,8 @@ double AUAudioOutputStream::GetHardwareLatency() {
NULL,
&size,
&device_latency_frames);
- DLOG_IF(WARNING, result != noErr) << "Could not get audio device latency.";
+ OSSTATUS_DLOG_IF(WARNING, result != noErr, result)
+ << "Could not get audio device latency";
// Get the stream latency.
property_address.mSelector = kAudioDevicePropertyStreams;
@@ -355,7 +356,8 @@ double AUAudioOutputStream::GetHardwareLatency() {
&stream_latency_frames);
}
}
- DLOG_IF(WARNING, result != noErr) << "Could not get audio stream latency.";
+ OSSTATUS_DLOG_IF(WARNING, result != noErr, result)
+ << "Could not get audio stream latency";
return static_cast<double>((audio_unit_latency_sec *
format_.mSampleRate) + device_latency_frames + stream_latency_frames);
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index 420415d..3751460 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <CoreAudio/AudioHardware.h>
+#include "base/mac/mac_logging.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
@@ -227,8 +228,8 @@ static AudioDeviceID GetAudioDeviceIdByUId(bool is_input,
}
if (result) {
- DLOG(WARNING) << "Unable to query device " << device_id
- << " for AudioDeviceID ";
+ OSSTATUS_DLOG(WARNING, result) << "Unable to query device " << device_id
+ << " for AudioDeviceID";
}
return audio_device_id;
diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc
index c230373..f4f4749 100644
--- a/media/audio/mac/audio_output_mac.cc
+++ b/media/audio/mac/audio_output_mac.cc
@@ -1,9 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/audio/mac/audio_output_mac.h"
+#include <CoreServices/CoreServices.h>
+
#include "base/basictypes.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
@@ -94,7 +96,8 @@ void PCMQueueOutAudioOutputStream::HandleError(OSStatus err) {
AudioSourceCallback* source = GetSource();
if (source)
source->OnError(this, static_cast<int>(err));
- NOTREACHED() << "error code " << err;
+ NOTREACHED() << "error " << GetMacOSStatusErrorString(err)
+ << " (" << err << ")";
}
bool PCMQueueOutAudioOutputStream::Open() {