OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager_mac.h" | 5 #include "media/audio/mac/audio_manager_mac.h" |
6 | 6 |
7 #include <CoreAudio/AudioHardware.h> | 7 #include <CoreAudio/AudioHardware.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 bool ShouldDeferStreamStart() { | 246 bool ShouldDeferStreamStart() { |
247 DCHECK(thread_checker_.CalledOnValidThread()); | 247 DCHECK(thread_checker_.CalledOnValidThread()); |
248 // Start() should be deferred if the system is in the middle of a suspend or | 248 // Start() should be deferred if the system is in the middle of a suspend or |
249 // has recently started the process of resuming. | 249 // has recently started the process of resuming. |
250 return is_suspending_ || base::TimeTicks::Now() < earliest_start_time_; | 250 return is_suspending_ || base::TimeTicks::Now() < earliest_start_time_; |
251 } | 251 } |
252 | 252 |
253 private: | 253 private: |
254 virtual void OnSuspend() OVERRIDE { | 254 virtual void OnSuspend() override { |
255 DCHECK(thread_checker_.CalledOnValidThread()); | 255 DCHECK(thread_checker_.CalledOnValidThread()); |
256 is_suspending_ = true; | 256 is_suspending_ = true; |
257 } | 257 } |
258 | 258 |
259 virtual void OnResume() OVERRIDE { | 259 virtual void OnResume() override { |
260 DCHECK(thread_checker_.CalledOnValidThread()); | 260 DCHECK(thread_checker_.CalledOnValidThread()); |
261 is_suspending_ = false; | 261 is_suspending_ = false; |
262 earliest_start_time_ = base::TimeTicks::Now() + | 262 earliest_start_time_ = base::TimeTicks::Now() + |
263 base::TimeDelta::FromSeconds(kStartDelayInSecsForPowerEvents); | 263 base::TimeDelta::FromSeconds(kStartDelayInSecsForPowerEvents); |
264 } | 264 } |
265 | 265 |
266 bool is_suspending_; | 266 bool is_suspending_; |
267 const bool is_monitoring_; | 267 const bool is_monitoring_; |
268 base::TimeTicks earliest_start_time_; | 268 base::TimeTicks earliest_start_time_; |
269 base::ThreadChecker thread_checker_; | 269 base::ThreadChecker thread_checker_; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) { | 747 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) { |
748 input_streams_.remove(stream); | 748 input_streams_.remove(stream); |
749 AudioManagerBase::ReleaseInputStream(stream); | 749 AudioManagerBase::ReleaseInputStream(stream); |
750 } | 750 } |
751 | 751 |
752 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 752 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
753 return new AudioManagerMac(audio_log_factory); | 753 return new AudioManagerMac(audio_log_factory); |
754 } | 754 } |
755 | 755 |
756 } // namespace media | 756 } // namespace media |
OLD | NEW |