| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // Helper method that stops, closes, and NULLs |*stream_|. | 215 // Helper method that stops, closes, and NULLs |*stream_|. |
| 216 void DoStopCloseAndClearStream(); | 216 void DoStopCloseAndClearStream(); |
| 217 | 217 |
| 218 // Checks if a stream was started successfully but never calls OnMoreData(). | 218 // Checks if a stream was started successfully but never calls OnMoreData(). |
| 219 void WedgeCheck(); | 219 void WedgeCheck(); |
| 220 | 220 |
| 221 // Send audio data to each duplication target. | 221 // Send audio data to each duplication target. |
| 222 void BroadcastDataToDuplicationTargets(std::unique_ptr<AudioBus> audio_bus, | 222 void BroadcastDataToDuplicationTargets(std::unique_ptr<AudioBus> audio_bus, |
| 223 base::TimeTicks reference_time); | 223 base::TimeTicks reference_time); |
| 224 | 224 |
| 225 // Log the current average power level measured by power_monitor_. |
| 226 void LogAudioPowerLevel(const std::string& call_name); |
| 227 |
| 225 AudioManager* const audio_manager_; | 228 AudioManager* const audio_manager_; |
| 226 const AudioParameters params_; | 229 const AudioParameters params_; |
| 227 EventHandler* const handler_; | 230 EventHandler* const handler_; |
| 228 | 231 |
| 229 // Specifies the device id of the output device to open or empty for the | 232 // Specifies the device id of the output device to open or empty for the |
| 230 // default output device. | 233 // default output device. |
| 231 std::string output_device_id_; | 234 std::string output_device_id_; |
| 232 | 235 |
| 233 AudioOutputStream* stream_; | 236 AudioOutputStream* stream_; |
| 234 | 237 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 249 | 252 |
| 250 // SyncReader is used only in low latency mode for synchronous reading. | 253 // SyncReader is used only in low latency mode for synchronous reading. |
| 251 SyncReader* const sync_reader_; | 254 SyncReader* const sync_reader_; |
| 252 | 255 |
| 253 // The message loop of audio manager thread that this object runs on. | 256 // The message loop of audio manager thread that this object runs on. |
| 254 const scoped_refptr<base::SingleThreadTaskRunner> message_loop_; | 257 const scoped_refptr<base::SingleThreadTaskRunner> message_loop_; |
| 255 | 258 |
| 256 // Scans audio samples from OnMoreData() as input to compute power levels. | 259 // Scans audio samples from OnMoreData() as input to compute power levels. |
| 257 AudioPowerMonitor power_monitor_; | 260 AudioPowerMonitor power_monitor_; |
| 258 | 261 |
| 262 // Updated each time a power measurement is logged. |
| 263 base::TimeTicks last_audio_level_log_time_; |
| 264 |
| 259 // Flags when we've asked for a stream to start but it never did. | 265 // Flags when we've asked for a stream to start but it never did. |
| 260 base::AtomicRefCount on_more_io_data_called_; | 266 base::AtomicRefCount on_more_io_data_called_; |
| 261 std::unique_ptr<base::OneShotTimer> wedge_timer_; | 267 std::unique_ptr<base::OneShotTimer> wedge_timer_; |
| 262 | 268 |
| 263 // Flag which indicates errors received during Stop/Close should be ignored. | 269 // Flag which indicates errors received during Stop/Close should be ignored. |
| 264 // These errors are generally harmless since a fresh stream is about to be | 270 // These errors are generally harmless since a fresh stream is about to be |
| 265 // recreated, but if forwarded, renderer side clients may consider them | 271 // recreated, but if forwarded, renderer side clients may consider them |
| 266 // catastrophic and abort their operations. | 272 // catastrophic and abort their operations. |
| 267 // | 273 // |
| 268 // If |stream_| is started then |ignore_errors_during_stop_close_| must only | 274 // If |stream_| is started then |ignore_errors_during_stop_close_| must only |
| 269 // be accessed while |error_lock_| is held. | 275 // be accessed while |error_lock_| is held. |
| 270 bool ignore_errors_during_stop_close_; | 276 bool ignore_errors_during_stop_close_; |
| 271 base::Lock error_lock_; | 277 base::Lock error_lock_; |
| 272 | 278 |
| 273 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); | 279 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
| 274 }; | 280 }; |
| 275 | 281 |
| 276 } // namespace media | 282 } // namespace media |
| 277 | 283 |
| 278 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ | 284 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ |
| OLD | NEW |