| 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 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/atomic_ref_count.h" | 8 #include "base/atomic_ref_count.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Changing the output device causes the controller to go through | 148 // Changing the output device causes the controller to go through |
| 149 // the same state transition back to the current state as a call to | 149 // the same state transition back to the current state as a call to |
| 150 // OnDeviceChange (unless it is currently diverting, see | 150 // OnDeviceChange (unless it is currently diverting, see |
| 151 // Start/StopDiverting below, in which case the state transition | 151 // Start/StopDiverting below, in which case the state transition |
| 152 // will happen when StopDiverting is called). | 152 // will happen when StopDiverting is called). |
| 153 void SwitchOutputDevice(const std::string& output_device_id, | 153 void SwitchOutputDevice(const std::string& output_device_id, |
| 154 const base::Closure& callback); | 154 const base::Closure& callback); |
| 155 | 155 |
| 156 // AudioSourceCallback implementation. | 156 // AudioSourceCallback implementation. |
| 157 virtual int OnMoreData(AudioBus* dest, | 157 virtual int OnMoreData(AudioBus* dest, |
| 158 uint32 total_bytes_delay) OVERRIDE; | 158 uint32 total_bytes_delay) override; |
| 159 virtual void OnError(AudioOutputStream* stream) OVERRIDE; | 159 virtual void OnError(AudioOutputStream* stream) override; |
| 160 | 160 |
| 161 // AudioDeviceListener implementation. When called AudioOutputController will | 161 // AudioDeviceListener implementation. When called AudioOutputController will |
| 162 // shutdown the existing |stream_|, transition to the kRecreating state, | 162 // shutdown the existing |stream_|, transition to the kRecreating state, |
| 163 // create a new stream, and then transition back to an equivalent state prior | 163 // create a new stream, and then transition back to an equivalent state prior |
| 164 // to being called. | 164 // to being called. |
| 165 virtual void OnDeviceChange() OVERRIDE; | 165 virtual void OnDeviceChange() override; |
| 166 | 166 |
| 167 // AudioSourceDiverter implementation. | 167 // AudioSourceDiverter implementation. |
| 168 virtual const AudioParameters& GetAudioParameters() OVERRIDE; | 168 virtual const AudioParameters& GetAudioParameters() override; |
| 169 virtual void StartDiverting(AudioOutputStream* to_stream) OVERRIDE; | 169 virtual void StartDiverting(AudioOutputStream* to_stream) override; |
| 170 virtual void StopDiverting() OVERRIDE; | 170 virtual void StopDiverting() override; |
| 171 | 171 |
| 172 // Accessor for AudioPowerMonitor::ReadCurrentPowerAndClip(). See comments in | 172 // Accessor for AudioPowerMonitor::ReadCurrentPowerAndClip(). See comments in |
| 173 // audio_power_monitor.h for usage. This may be called on any thread. | 173 // audio_power_monitor.h for usage. This may be called on any thread. |
| 174 std::pair<float, bool> ReadCurrentPowerAndClip(); | 174 std::pair<float, bool> ReadCurrentPowerAndClip(); |
| 175 | 175 |
| 176 protected: | 176 protected: |
| 177 // Internal state of the source. | 177 // Internal state of the source. |
| 178 enum State { | 178 enum State { |
| 179 kEmpty, | 179 kEmpty, |
| 180 kCreated, | 180 kCreated, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // Flags when we've asked for a stream to start but it never did. | 251 // Flags when we've asked for a stream to start but it never did. |
| 252 base::AtomicRefCount on_more_io_data_called_; | 252 base::AtomicRefCount on_more_io_data_called_; |
| 253 scoped_ptr<base::OneShotTimer<AudioOutputController> > wedge_timer_; | 253 scoped_ptr<base::OneShotTimer<AudioOutputController> > wedge_timer_; |
| 254 | 254 |
| 255 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); | 255 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
| 256 }; | 256 }; |
| 257 | 257 |
| 258 } // namespace media | 258 } // namespace media |
| 259 | 259 |
| 260 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 260 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
| OLD | NEW |