OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/audio/mac/audio_input_mac.h" | 5 #include "media/audio/mac/audio_input_mac.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "media/audio/audio_util.h" | 9 #include "media/audio/audio_util.h" |
10 #include "media/audio/mac/audio_manager_mac.h" | 10 #include "media/audio/mac/audio_manager_mac.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 &audio_queue_); | 56 &audio_queue_); |
57 if (err != noErr) { | 57 if (err != noErr) { |
58 HandleError(err); | 58 HandleError(err); |
59 return false; | 59 return false; |
60 } | 60 } |
61 return SetupBuffers(); | 61 return SetupBuffers(); |
62 } | 62 } |
63 | 63 |
64 void PCMQueueInAudioInputStream::Start(AudioInputCallback* callback) { | 64 void PCMQueueInAudioInputStream::Start(AudioInputCallback* callback) { |
65 DCHECK(callback); | 65 DCHECK(callback); |
66 DCHECK(audio_queue_) << "Must call Open() first"; | 66 DLOG_IF(ERROR, !audio_queue_) << "Open() has not been called successfully"; |
67 if (callback_) | 67 if (callback_ || !audio_queue_) |
68 return; | 68 return; |
69 callback_ = callback; | 69 callback_ = callback; |
70 OSStatus err = AudioQueueStart(audio_queue_, NULL); | 70 OSStatus err = AudioQueueStart(audio_queue_, NULL); |
71 if (err != noErr) | 71 if (err != noErr) |
72 HandleError(err); | 72 HandleError(err); |
73 else | 73 else |
74 manager_->IncreaseActiveInputStreamCount(); | 74 manager_->IncreaseActiveInputStreamCount(); |
75 } | 75 } |
76 | 76 |
77 void PCMQueueInAudioInputStream::Stop() { | 77 void PCMQueueInAudioInputStream::Stop() { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // TODO(joth): PCMQueueOutAudioOutputStream uses callback_ to provide an | 177 // TODO(joth): PCMQueueOutAudioOutputStream uses callback_ to provide an |
178 // extra guard for this situation, but it seems to introduce more | 178 // extra guard for this situation, but it seems to introduce more |
179 // complications than it solves (memory barrier issues accessing it from | 179 // complications than it solves (memory barrier issues accessing it from |
180 // multiple threads, looses the means to indicate OnClosed to client). | 180 // multiple threads, looses the means to indicate OnClosed to client). |
181 // Should determine if we need to do something equivalent here. | 181 // Should determine if we need to do something equivalent here. |
182 return; | 182 return; |
183 } | 183 } |
184 HandleError(err); | 184 HandleError(err); |
185 } | 185 } |
186 } | 186 } |
OLD | NEW |