summaryrefslogtreecommitdiffstats
path: root/media/audio/mac/audio_input_mac.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-14 23:07:14 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-14 23:07:14 +0000
commit5a6e2dd4c11d1c1faadf1488d92e58ad17763f6c (patch)
tree2f12b1d382b4aa1b771bd264eb69e5c28a3c3b6a /media/audio/mac/audio_input_mac.cc
parent942ba283b3d147f211e4995ee0a5c9cec8071aab (diff)
downloadchromium_src-5a6e2dd4c11d1c1faadf1488d92e58ad17763f6c.zip
chromium_src-5a6e2dd4c11d1c1faadf1488d92e58ad17763f6c.tar.gz
chromium_src-5a6e2dd4c11d1c1faadf1488d92e58ad17763f6c.tar.bz2
Enable the AudioInputTest tests on the build bots and fix a bug in PCMQueueInAudioInputStream.
The tests should all succeed but on bots where audio hardware is missing, we should get a printout that no devices were detected. Notably the mac bots do have the necessary equipment which is how I ran into the bug. TEST=This runs more tests in media_unittests on the bots. Review URL: http://codereview.chromium.org/8941001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/mac/audio_input_mac.cc')
-rw-r--r--media/audio/mac/audio_input_mac.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/media/audio/mac/audio_input_mac.cc b/media/audio/mac/audio_input_mac.cc
index 3f73c2e..eb6f167 100644
--- a/media/audio/mac/audio_input_mac.cc
+++ b/media/audio/mac/audio_input_mac.cc
@@ -21,7 +21,8 @@ PCMQueueInAudioInputStream::PCMQueueInAudioInputStream(
: manager_(manager),
callback_(NULL),
audio_queue_(NULL),
- buffer_size_bytes_(0) {
+ buffer_size_bytes_(0),
+ started_(false) {
// We must have a manager.
DCHECK(manager_);
// A frame is one sample across all channels. In interleaved audio the per
@@ -68,15 +69,18 @@ void PCMQueueInAudioInputStream::Start(AudioInputCallback* callback) {
return;
callback_ = callback;
OSStatus err = AudioQueueStart(audio_queue_, NULL);
- if (err != noErr)
+ if (err != noErr) {
HandleError(err);
- else
+ } else {
+ started_ = true;
manager_->IncreaseActiveInputStreamCount();
+ }
}
void PCMQueueInAudioInputStream::Stop() {
- if (!audio_queue_)
+ if (!audio_queue_ || !started_)
return;
+
// Stop is always called before Close. In case of error, this will be
// also called when closing the input controller.
manager_->DecreaseActiveInputStreamCount();
@@ -86,6 +90,8 @@ void PCMQueueInAudioInputStream::Stop() {
OSStatus err = AudioQueueStop(audio_queue_, true);
if (err != noErr)
HandleError(err);
+
+ started_ = false;
}
void PCMQueueInAudioInputStream::Close() {