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

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

Issue 233823003: Defer input stream start around suspend and resume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests. Created 6 years, 8 months 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/audio_input_unittest.cc ('k') | media/audio/mac/audio_input_mac.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_auhal_mac.h" 5 #include "media/audio/mac/audio_auhal_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/bind.h" 10 #include "base/bind.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 void AUHALStream::Start(AudioSourceCallback* callback) { 147 void AUHALStream::Start(AudioSourceCallback* callback) {
148 DCHECK(callback); 148 DCHECK(callback);
149 if (!audio_unit_) { 149 if (!audio_unit_) {
150 DLOG(ERROR) << "Open() has not been called successfully"; 150 DLOG(ERROR) << "Open() has not been called successfully";
151 return; 151 return;
152 } 152 }
153 153
154 // Check if we should defer Start() for http://crbug.com/160920. 154 // Check if we should defer Start() for http://crbug.com/160920.
155 if (manager_->ShouldDeferOutputStreamStart()) { 155 if (manager_->ShouldDeferStreamStart()) {
156 // Use a cancellable closure so that if Stop() is called before Start() 156 // Use a cancellable closure so that if Stop() is called before Start()
157 // actually runs, we can cancel the pending start. 157 // actually runs, we can cancel the pending start.
158 DCHECK(deferred_start_cb_.IsCancelled()); 158 DCHECK(deferred_start_cb_.IsCancelled());
159 deferred_start_cb_.Reset( 159 deferred_start_cb_.Reset(
160 base::Bind(&AUHALStream::Start, base::Unretained(this), callback)); 160 base::Bind(&AUHALStream::Start, base::Unretained(this), callback));
161 manager_->GetTaskRunner()->PostDelayedTask( 161 manager_->GetTaskRunner()->PostDelayedTask(
162 FROM_HERE, deferred_start_cb_.callback(), base::TimeDelta::FromSeconds( 162 FROM_HERE, deferred_start_cb_.callback(), base::TimeDelta::FromSeconds(
163 AudioManagerMac::kStartDelayInSecsForPowerEvents)); 163 AudioManagerMac::kStartDelayInSecsForPowerEvents));
164 return; 164 return;
165 } 165 }
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 result = AudioUnitInitialize(audio_unit_); 545 result = AudioUnitInitialize(audio_unit_);
546 if (result != noErr) { 546 if (result != noErr) {
547 OSSTATUS_DLOG(ERROR, result) << "AudioUnitInitialize() failed."; 547 OSSTATUS_DLOG(ERROR, result) << "AudioUnitInitialize() failed.";
548 return false; 548 return false;
549 } 549 }
550 550
551 return true; 551 return true;
552 } 552 }
553 553
554 } // namespace media 554 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_unittest.cc ('k') | media/audio/mac/audio_input_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698