| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |