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). |
11 // | 11 // |
12 | 12 |
13 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ | 13 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ |
14 #define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ | 14 #define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ |
15 | 15 |
16 #include <stddef.h> | 16 #include <stddef.h> |
17 | 17 |
18 #include <map> | 18 #include <map> |
| 19 #include <memory> |
19 #include <vector> | 20 #include <vector> |
20 | 21 |
21 #include "base/macros.h" | 22 #include "base/macros.h" |
22 #include "base/memory/ref_counted.h" | 23 #include "base/memory/ref_counted.h" |
23 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
24 #include "media/audio/audio_io.h" | 25 #include "media/audio/audio_io.h" |
25 #include "media/audio/audio_logging.h" | 26 #include "media/audio/audio_logging.h" |
26 #include "media/audio/audio_manager.h" | 27 #include "media/audio/audio_manager.h" |
27 #include "media/audio/audio_output_dispatcher.h" | 28 #include "media/audio/audio_output_dispatcher.h" |
28 #include "media/base/audio_parameters.h" | 29 #include "media/base/audio_parameters.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 std::vector<AudioOutputStream*> idle_streams_; | 85 std::vector<AudioOutputStream*> idle_streams_; |
85 | 86 |
86 // When streams are stopped they're added to |idle_streams_|, if no stream is | 87 // When streams are stopped they're added to |idle_streams_|, if no stream is |
87 // reused before |close_delay_| elapses |close_timer_| will run | 88 // reused before |close_delay_| elapses |close_timer_| will run |
88 // CloseIdleStreams(). | 89 // CloseIdleStreams(). |
89 base::DelayTimer close_timer_; | 90 base::DelayTimer close_timer_; |
90 | 91 |
91 typedef std::map<AudioOutputProxy*, AudioOutputStream*> AudioStreamMap; | 92 typedef std::map<AudioOutputProxy*, AudioOutputStream*> AudioStreamMap; |
92 AudioStreamMap proxy_to_physical_map_; | 93 AudioStreamMap proxy_to_physical_map_; |
93 | 94 |
94 scoped_ptr<AudioLog> audio_log_; | 95 std::unique_ptr<AudioLog> audio_log_; |
95 typedef std::map<AudioOutputStream*, int> AudioStreamIDMap; | 96 typedef std::map<AudioOutputStream*, int> AudioStreamIDMap; |
96 AudioStreamIDMap audio_stream_ids_; | 97 AudioStreamIDMap audio_stream_ids_; |
97 int audio_stream_id_; | 98 int audio_stream_id_; |
98 | 99 |
99 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); | 100 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcherImpl); |
100 }; | 101 }; |
101 | 102 |
102 } // namespace media | 103 } // namespace media |
103 | 104 |
104 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ | 105 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_IMPL_H_ |
OLD | NEW |