summaryrefslogtreecommitdiffstats
path: root/media/audio
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-08 22:34:03 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-08 22:34:03 +0000
commitf3a4a98ad887739616e06b9948a2deecc289b131 (patch)
tree8ffc8d88aec96449ba6b8fc11ccf1c7435e8f45c /media/audio
parent4d52923375a83af70372df26404e3dd80c2ef4b6 (diff)
downloadchromium_src-f3a4a98ad887739616e06b9948a2deecc289b131.zip
chromium_src-f3a4a98ad887739616e06b9948a2deecc289b131.tar.gz
chromium_src-f3a4a98ad887739616e06b9948a2deecc289b131.tar.bz2
Make check for 'opened' consistent across all audio stream implementations of Start() and log an error if open hasn't been called successfully.
This fixes BUG=106712 TEST=Run media_unittests. Review URL: http://codereview.chromium.org/8872028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio')
-rw-r--r--media/audio/mac/audio_input_mac.cc4
-rw-r--r--media/audio/mac/audio_low_latency_input_mac.cc3
-rw-r--r--media/audio/mac/audio_low_latency_output_mac.cc4
-rw-r--r--media/audio/mac/audio_output_mac.cc4
-rw-r--r--media/audio/pulse/pulse_output.cc6
-rw-r--r--media/audio/win/audio_low_latency_input_win.cc3
-rw-r--r--media/audio/win/audio_low_latency_output_win.cc3
7 files changed, 19 insertions, 8 deletions
diff --git a/media/audio/mac/audio_input_mac.cc b/media/audio/mac/audio_input_mac.cc
index c59eb61..3f73c2e 100644
--- a/media/audio/mac/audio_input_mac.cc
+++ b/media/audio/mac/audio_input_mac.cc
@@ -63,8 +63,8 @@ bool PCMQueueInAudioInputStream::Open() {
void PCMQueueInAudioInputStream::Start(AudioInputCallback* callback) {
DCHECK(callback);
- DCHECK(audio_queue_) << "Must call Open() first";
- if (callback_)
+ DLOG_IF(ERROR, !audio_queue_) << "Open() has not been called successfully";
+ if (callback_ || !audio_queue_)
return;
callback_ = callback;
OSStatus err = AudioQueueStart(audio_queue_, NULL);
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index 00236fa..bd534e1 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -215,7 +215,8 @@ bool AUAudioInputStream::Open() {
void AUAudioInputStream::Start(AudioInputCallback* callback) {
DCHECK(callback);
- if (started_)
+ DLOG_IF(ERROR, !audio_unit_) << "Open() has not been called successfully";
+ if (started_ || !audio_unit_)
return;
sink_ = callback;
OSStatus result = AudioOutputUnitStart(audio_unit_);
diff --git a/media/audio/mac/audio_low_latency_output_mac.cc b/media/audio/mac/audio_low_latency_output_mac.cc
index 259e240..a304c64 100644
--- a/media/audio/mac/audio_low_latency_output_mac.cc
+++ b/media/audio/mac/audio_low_latency_output_mac.cc
@@ -175,6 +175,10 @@ void AUAudioOutputStream::Close() {
void AUAudioOutputStream::Start(AudioSourceCallback* callback) {
DCHECK(callback);
+ DLOG_IF(ERROR, !output_unit_) << "Open() has not been called successfully";
+ if (!output_unit_)
+ return;
+
source_ = callback;
AudioOutputUnitStart(output_unit_);
diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc
index 7fbed99..c230373 100644
--- a/media/audio/mac/audio_output_mac.cc
+++ b/media/audio/mac/audio_output_mac.cc
@@ -479,6 +479,10 @@ void PCMQueueOutAudioOutputStream::RenderCallback(void* p_this,
void PCMQueueOutAudioOutputStream::Start(AudioSourceCallback* callback) {
DCHECK(callback);
+ DLOG_IF(ERROR, !audio_queue_) << "Open() has not been called successfully";
+ if (!audio_queue_)
+ return;
+
OSStatus err = noErr;
SetSource(callback);
pending_bytes_ = 0;
diff --git a/media/audio/pulse/pulse_output.cc b/media/audio/pulse/pulse_output.cc
index 5010a9e..5b55509 100644
--- a/media/audio/pulse/pulse_output.cc
+++ b/media/audio/pulse/pulse_output.cc
@@ -383,8 +383,12 @@ void PulseAudioOutputStream::WriteToStream(size_t bytes_to_write,
void PulseAudioOutputStream::Start(AudioSourceCallback* callback) {
DCHECK_EQ(message_loop_, MessageLoop::current());
-
CHECK(callback);
+ DLOG_IF(ERROR, !playback_handle_)
+ << "Open() has not been called successfully";
+ if (!playback_handle_)
+ return;
+
source_callback_ = callback;
// Clear buffer, it might still have data in it.
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc
index fc6630b..c6bb0ed 100644
--- a/media/audio/win/audio_low_latency_input_win.cc
+++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -121,8 +121,7 @@ bool WASAPIAudioInputStream::Open() {
void WASAPIAudioInputStream::Start(AudioInputCallback* callback) {
DCHECK(callback);
- DCHECK(opened_);
-
+ DLOG_IF(ERROR, !opened_) << "Open() has not been called successfully";
if (!opened_)
return;
diff --git a/media/audio/win/audio_low_latency_output_win.cc b/media/audio/win/audio_low_latency_output_win.cc
index dc9c6ec..b036b94 100644
--- a/media/audio/win/audio_low_latency_output_win.cc
+++ b/media/audio/win/audio_low_latency_output_win.cc
@@ -117,8 +117,7 @@ bool WASAPIAudioOutputStream::Open() {
void WASAPIAudioOutputStream::Start(AudioSourceCallback* callback) {
DCHECK_EQ(GetCurrentThreadId(), creating_thread_id_);
DCHECK(callback);
- DCHECK(opened_);
-
+ DLOG_IF(ERROR, !opened_) << "Open() has not been called successfully";
if (!opened_)
return;