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

Side by Side Diff: media/audio/mac/audio_low_latency_input_mac.cc

Issue 8872028: Make check for 'opened' consistent across all audio stream implementations of Start() and log an ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/mac/audio_input_mac.cc ('k') | media/audio/mac/audio_low_latency_output_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_low_latency_input_mac.h" 5 #include "media/audio/mac/audio_low_latency_input_mac.h"
6 6
7 #include <CoreServices/CoreServices.h> 7 #include <CoreServices/CoreServices.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 // The hardware latency is fixed and will not change during the call. 210 // The hardware latency is fixed and will not change during the call.
211 hardware_latency_frames_ = GetHardwareLatency(); 211 hardware_latency_frames_ = GetHardwareLatency();
212 212
213 return true; 213 return true;
214 } 214 }
215 215
216 void AUAudioInputStream::Start(AudioInputCallback* callback) { 216 void AUAudioInputStream::Start(AudioInputCallback* callback) {
217 DCHECK(callback); 217 DCHECK(callback);
218 if (started_) 218 DLOG_IF(ERROR, !audio_unit_) << "Open() has not been called successfully";
219 if (started_ || !audio_unit_)
219 return; 220 return;
220 sink_ = callback; 221 sink_ = callback;
221 OSStatus result = AudioOutputUnitStart(audio_unit_); 222 OSStatus result = AudioOutputUnitStart(audio_unit_);
222 if (result == noErr) { 223 if (result == noErr) {
223 started_ = true; 224 started_ = true;
224 } 225 }
225 DLOG_IF(ERROR, result != noErr) << "Failed to start acquiring data"; 226 DLOG_IF(ERROR, result != noErr) << "Failed to start acquiring data";
226 } 227 }
227 228
228 void AUAudioInputStream::Stop() { 229 void AUAudioInputStream::Stop() {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // Total latency is composed by the dynamic latency and the fixed 433 // Total latency is composed by the dynamic latency and the fixed
433 // hardware latency. 434 // hardware latency.
434 return (delay_frames + hardware_latency_frames_); 435 return (delay_frames + hardware_latency_frames_);
435 } 436 }
436 437
437 void AUAudioInputStream::HandleError(OSStatus err) { 438 void AUAudioInputStream::HandleError(OSStatus err) {
438 NOTREACHED() << "error code: " << err; 439 NOTREACHED() << "error code: " << err;
439 if (sink_) 440 if (sink_)
440 sink_->OnError(this, static_cast<int>(err)); 441 sink_->OnError(this, static_cast<int>(err));
441 } 442 }
OLDNEW
« no previous file with comments | « media/audio/mac/audio_input_mac.cc ('k') | media/audio/mac/audio_low_latency_output_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698