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

Side by Side Diff: media/audio/mac/audio_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_output_mac.cc ('k') | media/audio/pulse/pulse_output.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_output_mac.h" 5 #include "media/audio/mac/audio_output_mac.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // indeed been closed. 472 // indeed been closed.
473 if (!audio_stream->GetSource()) 473 if (!audio_stream->GetSource())
474 return; 474 return;
475 } 475 }
476 audio_stream->HandleError(err); 476 audio_stream->HandleError(err);
477 } 477 }
478 } 478 }
479 479
480 void PCMQueueOutAudioOutputStream::Start(AudioSourceCallback* callback) { 480 void PCMQueueOutAudioOutputStream::Start(AudioSourceCallback* callback) {
481 DCHECK(callback); 481 DCHECK(callback);
482 DLOG_IF(ERROR, !audio_queue_) << "Open() has not been called successfully";
483 if (!audio_queue_)
484 return;
485
482 OSStatus err = noErr; 486 OSStatus err = noErr;
483 SetSource(callback); 487 SetSource(callback);
484 pending_bytes_ = 0; 488 pending_bytes_ = 0;
485 // Ask the source to pre-fill all our buffers before playing. 489 // Ask the source to pre-fill all our buffers before playing.
486 for (uint32 ix = 0; ix != kNumBuffers; ++ix) { 490 for (uint32 ix = 0; ix != kNumBuffers; ++ix) {
487 buffer_[ix]->mAudioDataByteSize = 0; 491 buffer_[ix]->mAudioDataByteSize = 0;
488 // Caller waits for 1st packet to become available, but not for others, 492 // Caller waits for 1st packet to become available, but not for others,
489 // so we wait for them here. 493 // so we wait for them here.
490 if (ix != 0) { 494 if (ix != 0) {
491 AudioSourceCallback* source = GetSource(); 495 AudioSourceCallback* source = GetSource();
(...skipping 21 matching lines...) Expand all
513 void PCMQueueOutAudioOutputStream::SetSource(AudioSourceCallback* source) { 517 void PCMQueueOutAudioOutputStream::SetSource(AudioSourceCallback* source) {
514 base::AutoLock lock(source_lock_); 518 base::AutoLock lock(source_lock_);
515 source_ = source; 519 source_ = source;
516 } 520 }
517 521
518 AudioOutputStream::AudioSourceCallback* 522 AudioOutputStream::AudioSourceCallback*
519 PCMQueueOutAudioOutputStream::GetSource() { 523 PCMQueueOutAudioOutputStream::GetSource() {
520 base::AutoLock lock(source_lock_); 524 base::AutoLock lock(source_lock_);
521 return source_; 525 return source_;
522 } 526 }
OLDNEW
« no previous file with comments | « media/audio/mac/audio_low_latency_output_mac.cc ('k') | media/audio/pulse/pulse_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698