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

Side by Side Diff: media/audio/mac/audio_low_latency_output_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_low_latency_input_mac.cc ('k') | media/audio/mac/audio_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_output_mac.h" 5 #include "media/audio/mac/audio_low_latency_output_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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (output_unit_) 168 if (output_unit_)
169 CloseComponent(output_unit_); 169 CloseComponent(output_unit_);
170 170
171 // Inform the audio manager that we have been closed. This can cause our 171 // Inform the audio manager that we have been closed. This can cause our
172 // destruction. 172 // destruction.
173 manager_->ReleaseOutputStream(this); 173 manager_->ReleaseOutputStream(this);
174 } 174 }
175 175
176 void AUAudioOutputStream::Start(AudioSourceCallback* callback) { 176 void AUAudioOutputStream::Start(AudioSourceCallback* callback) {
177 DCHECK(callback); 177 DCHECK(callback);
178 DLOG_IF(ERROR, !output_unit_) << "Open() has not been called successfully";
179 if (!output_unit_)
180 return;
181
178 source_ = callback; 182 source_ = callback;
179 183
180 AudioOutputUnitStart(output_unit_); 184 AudioOutputUnitStart(output_unit_);
181 } 185 }
182 186
183 void AUAudioOutputStream::Stop() { 187 void AUAudioOutputStream::Stop() {
184 // We request a synchronous stop, so the next call can take some time. In 188 // We request a synchronous stop, so the next call can take some time. In
185 // the windows implementation we block here as well. 189 // the windows implementation we block here as well.
186 source_ = NULL; 190 source_ = NULL;
187 191
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // Get the delay between the moment getting the callback and the scheduled 366 // Get the delay between the moment getting the callback and the scheduled
363 // time stamp that tells when the data is going to be played out. 367 // time stamp that tells when the data is going to be played out.
364 UInt64 output_time_ns = AudioConvertHostTimeToNanos( 368 UInt64 output_time_ns = AudioConvertHostTimeToNanos(
365 output_time_stamp->mHostTime); 369 output_time_stamp->mHostTime);
366 UInt64 now_ns = AudioConvertHostTimeToNanos(AudioGetCurrentHostTime()); 370 UInt64 now_ns = AudioConvertHostTimeToNanos(AudioGetCurrentHostTime());
367 double delay_frames = static_cast<double> 371 double delay_frames = static_cast<double>
368 (1e-9 * (output_time_ns - now_ns) * format_.mSampleRate); 372 (1e-9 * (output_time_ns - now_ns) * format_.mSampleRate);
369 373
370 return (delay_frames + hardware_latency_frames_); 374 return (delay_frames + hardware_latency_frames_);
371 } 375 }
OLDNEW
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac.cc ('k') | media/audio/mac/audio_output_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698