| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // opened. | 71 // opened. |
| 72 bool CreateAndOpenStream(); | 72 bool CreateAndOpenStream(); |
| 73 | 73 |
| 74 // Before a stream is reused, it should sit idle for a bit. This task is | 74 // Before a stream is reused, it should sit idle for a bit. This task is |
| 75 // called once that time has elapsed. | 75 // called once that time has elapsed. |
| 76 void StopStreamTask(); | 76 void StopStreamTask(); |
| 77 | 77 |
| 78 // Called by |close_timer_|. Closes all pending streams. | 78 // Called by |close_timer_|. Closes all pending streams. |
| 79 void ClosePendingStreams(); | 79 void ClosePendingStreams(); |
| 80 | 80 |
| 81 void LogCloseStream(AudioOutputStream* stream); |
| 82 |
| 81 base::TimeDelta pause_delay_; | 83 base::TimeDelta pause_delay_; |
| 82 size_t paused_proxies_; | 84 size_t paused_proxies_; |
| 83 typedef std::list<AudioOutputStream*> AudioOutputStreamList; | 85 typedef std::list<AudioOutputStream*> AudioOutputStreamList; |
| 84 AudioOutputStreamList idle_streams_; | 86 AudioOutputStreamList idle_streams_; |
| 85 AudioOutputStreamList pausing_streams_; | 87 AudioOutputStreamList pausing_streams_; |
| 86 | 88 |
| 87 // Used to post delayed tasks to ourselves that we cancel inside Shutdown(). | 89 // Used to post delayed tasks to ourselves that we cancel inside Shutdown(). |
| 88 base::WeakPtrFactory<AudioOutputDispatcherImpl> weak_this_; | 90 base::WeakPtrFactory<AudioOutputDispatcherImpl> weak_this_; |
| 89 base::DelayTimer<AudioOutputDispatcherImpl> close_timer_; | 91 base::DelayTimer<AudioOutputDispatcherImpl> close_timer_; |
| 90 | 92 |
| 91 AudioStreamMap proxy_to_physical_map_; | 93 AudioStreamMap proxy_to_physical_map_; |
| 92 | 94 |
| 93 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); | 95 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); |
| 94 }; | 96 }; |
| 95 | 97 |
| 96 } // namespace media | 98 } // namespace media |
| 97 | 99 |
| 98 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ | 100 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ |
| OLD | NEW |