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_MANAGER_BASE_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. | 95 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. |
96 virtual AudioInputStream* MakeLowLatencyInputStream( | 96 virtual AudioInputStream* MakeLowLatencyInputStream( |
97 const AudioParameters& params, const std::string& device_id) = 0; | 97 const AudioParameters& params, const std::string& device_id) = 0; |
98 | 98 |
99 // Listeners will be notified on the GetTaskRunner() task runner. | 99 // Listeners will be notified on the GetTaskRunner() task runner. |
100 virtual void AddOutputDeviceChangeListener( | 100 virtual void AddOutputDeviceChangeListener( |
101 AudioDeviceListener* listener) OVERRIDE; | 101 AudioDeviceListener* listener) OVERRIDE; |
102 virtual void RemoveOutputDeviceChangeListener( | 102 virtual void RemoveOutputDeviceChangeListener( |
103 AudioDeviceListener* listener) OVERRIDE; | 103 AudioDeviceListener* listener) OVERRIDE; |
104 | 104 |
105 // TODO ---- | |
Henrik Grunell
2014/08/22 16:14:43
Add text to comment or remove.
henrika (OOO until Aug 14)
2014/08/25 12:47:45
Renamed and improved. Will need second opinion if
| |
106 virtual void AddStateChangeListener(StateChangeListener* listener) OVERRIDE; | |
107 virtual void RemoveStateChangeListener( | |
108 StateChangeListener* listener) OVERRIDE; | |
109 | |
105 virtual AudioParameters GetDefaultOutputStreamParameters() OVERRIDE; | 110 virtual AudioParameters GetDefaultOutputStreamParameters() OVERRIDE; |
106 virtual AudioParameters GetOutputStreamParameters( | 111 virtual AudioParameters GetOutputStreamParameters( |
107 const std::string& device_id) OVERRIDE; | 112 const std::string& device_id) OVERRIDE; |
108 | 113 |
109 virtual AudioParameters GetInputStreamParameters( | 114 virtual AudioParameters GetInputStreamParameters( |
110 const std::string& device_id) OVERRIDE; | 115 const std::string& device_id) OVERRIDE; |
111 | 116 |
112 virtual std::string GetAssociatedOutputDeviceID( | 117 virtual std::string GetAssociatedOutputDeviceID( |
113 const std::string& input_device_id) OVERRIDE; | 118 const std::string& input_device_id) OVERRIDE; |
114 | 119 |
(...skipping 13 matching lines...) Expand all Loading... | |
128 // implementation. | 133 // implementation. |
129 void Shutdown(); | 134 void Shutdown(); |
130 | 135 |
131 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } | 136 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } |
132 | 137 |
133 // Called by each platform specific AudioManager to notify output state change | 138 // Called by each platform specific AudioManager to notify output state change |
134 // listeners that a state change has occurred. Must be called from the audio | 139 // listeners that a state change has occurred. Must be called from the audio |
135 // thread. | 140 // thread. |
136 void NotifyAllOutputDeviceChangeListeners(); | 141 void NotifyAllOutputDeviceChangeListeners(); |
137 | 142 |
143 void NotifyAllStateChangeListeners(const std::string& msg); | |
144 | |
138 // Returns user buffer size as specified on the command line or 0 if no buffer | 145 // Returns user buffer size as specified on the command line or 0 if no buffer |
139 // size has been specified. | 146 // size has been specified. |
140 int GetUserBufferSize(); | 147 int GetUserBufferSize(); |
141 | 148 |
142 // Returns the preferred hardware audio output parameters for opening output | 149 // Returns the preferred hardware audio output parameters for opening output |
143 // streams. If the users inject a valid |input_params|, each AudioManager | 150 // streams. If the users inject a valid |input_params|, each AudioManager |
144 // will decide if they should return the values from |input_params| or the | 151 // will decide if they should return the values from |input_params| or the |
145 // default hardware values. If the |input_params| is invalid, it will return | 152 // default hardware values. If the |input_params| is invalid, it will return |
146 // the default hardware audio parameters. | 153 // the default hardware audio parameters. |
147 // If |output_device_id| is empty, the implementation must treat that as | 154 // If |output_device_id| is empty, the implementation must treat that as |
(...skipping 24 matching lines...) Expand all Loading... | |
172 | 179 |
173 // Number of currently open output streams. | 180 // Number of currently open output streams. |
174 int num_output_streams_; | 181 int num_output_streams_; |
175 | 182 |
176 // Number of currently open input streams. | 183 // Number of currently open input streams. |
177 int num_input_streams_; | 184 int num_input_streams_; |
178 | 185 |
179 // Track output state change listeners. | 186 // Track output state change listeners. |
180 ObserverList<AudioDeviceListener> output_listeners_; | 187 ObserverList<AudioDeviceListener> output_listeners_; |
181 | 188 |
189 // Track ..... | |
Henrik Grunell
2014/08/22 16:14:43
Track down pink ducks? Tracks with Kaj Kindwall? S
henrika (OOO until Aug 14)
2014/08/25 12:47:45
Will improve ;-)
| |
190 ObserverList<StateChangeListener> state_listeners_; | |
191 | |
182 // Thread used to interact with audio streams created by this audio manager. | 192 // Thread used to interact with audio streams created by this audio manager. |
183 base::Thread audio_thread_; | 193 base::Thread audio_thread_; |
184 | 194 |
185 // The task runner of the audio thread this object runs on. Used for internal | 195 // The task runner of the audio thread this object runs on. Used for internal |
186 // tasks which run on the audio thread even after Shutdown() has been started | 196 // tasks which run on the audio thread even after Shutdown() has been started |
187 // and GetTaskRunner() starts returning NULL. | 197 // and GetTaskRunner() starts returning NULL. |
188 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 198 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
189 | 199 |
190 // Map of cached AudioOutputDispatcher instances. Must only be touched | 200 // Map of cached AudioOutputDispatcher instances. Must only be touched |
191 // from the audio thread (no locking). | 201 // from the audio thread (no locking). |
192 AudioOutputDispatchers output_dispatchers_; | 202 AudioOutputDispatchers output_dispatchers_; |
193 | 203 |
194 // Proxy for creating AudioLog objects. | 204 // Proxy for creating AudioLog objects. |
195 AudioLogFactory* const audio_log_factory_; | 205 AudioLogFactory* const audio_log_factory_; |
196 | 206 |
197 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 207 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
198 }; | 208 }; |
199 | 209 |
200 } // namespace media | 210 } // namespace media |
201 | 211 |
202 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 212 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |