| 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 // AudioOutputDispatcherImpl is an implementation of AudioOutputDispatcher. | 5 // AudioOutputDispatcherImpl is an implementation of AudioOutputDispatcher. |
| 6 // | 6 // |
| 7 // To avoid opening and closing audio devices more frequently than necessary, | 7 // To avoid opening and closing audio devices more frequently than necessary, |
| 8 // each dispatcher has a pool of inactive physical streams. A stream is closed | 8 // each dispatcher has a pool of inactive physical streams. A stream is closed |
| 9 // only if it hasn't been used for a certain period of time (specified via the | 9 // only if it hasn't been used for a certain period of time (specified via the |
| 10 // constructor). | 10 // constructor). |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void CloseAllIdleStreams(); | 76 void CloseAllIdleStreams(); |
| 77 // Similar to CloseAllIdleStreams(), but keeps |keep_alive| streams alive. | 77 // Similar to CloseAllIdleStreams(), but keeps |keep_alive| streams alive. |
| 78 void CloseIdleStreams(size_t keep_alive); | 78 void CloseIdleStreams(size_t keep_alive); |
| 79 | 79 |
| 80 size_t idle_proxies_; | 80 size_t idle_proxies_; |
| 81 std::vector<AudioOutputStream*> idle_streams_; | 81 std::vector<AudioOutputStream*> idle_streams_; |
| 82 | 82 |
| 83 // When streams are stopped they're added to |idle_streams_|, if no stream is | 83 // When streams are stopped they're added to |idle_streams_|, if no stream is |
| 84 // reused before |close_delay_| elapses |close_timer_| will run | 84 // reused before |close_delay_| elapses |close_timer_| will run |
| 85 // CloseIdleStreams(). | 85 // CloseIdleStreams(). |
| 86 base::DelayTimer<AudioOutputDispatcherImpl> close_timer_; | 86 base::DelayTimer close_timer_; |
| 87 | 87 |
| 88 typedef std::map<AudioOutputProxy*, AudioOutputStream*> AudioStreamMap; | 88 typedef std::map<AudioOutputProxy*, AudioOutputStream*> AudioStreamMap; |
| 89 AudioStreamMap proxy_to_physical_map_; | 89 AudioStreamMap proxy_to_physical_map_; |
| 90 | 90 |
| 91 scoped_ptr<AudioLog> audio_log_; | 91 scoped_ptr<AudioLog> audio_log_; |
| 92 typedef std::map<AudioOutputStream*, int> AudioStreamIDMap; | 92 typedef std::map<AudioOutputStream*, int> AudioStreamIDMap; |
| 93 AudioStreamIDMap audio_stream_ids_; | 93 AudioStreamIDMap audio_stream_ids_; |
| 94 int audio_stream_id_; | 94 int audio_stream_id_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); | 96 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace media | 99 } // namespace media |
| 100 | 100 |
| 101 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ | 101 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ |
| OLD | NEW |