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 30 matching lines...) Expand all Loading... |
41 // AudioInputStream will be capturing audio currently being played on the | 41 // AudioInputStream will be capturing audio currently being played on the |
42 // default playback device. At the moment this feature is supported only on | 42 // default playback device. At the moment this feature is supported only on |
43 // some platforms. AudioInputStream::Intialize() will return an error on | 43 // some platforms. AudioInputStream::Intialize() will return an error on |
44 // platforms that don't support it. GetInputStreamParameters() must be used | 44 // platforms that don't support it. GetInputStreamParameters() must be used |
45 // to get the parameters of the loopback device before creating a loopback | 45 // to get the parameters of the loopback device before creating a loopback |
46 // stream, otherwise stream initialization may fail. | 46 // stream, otherwise stream initialization may fail. |
47 static const char kLoopbackInputDeviceId[]; | 47 static const char kLoopbackInputDeviceId[]; |
48 | 48 |
49 virtual ~AudioManagerBase(); | 49 virtual ~AudioManagerBase(); |
50 | 50 |
51 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE; | 51 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE; |
52 virtual scoped_refptr<base::MessageLoopProxy> GetWorkerLoop() OVERRIDE; | 52 virtual scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() |
| 53 OVERRIDE; |
53 | 54 |
54 virtual base::string16 GetAudioInputDeviceModel() OVERRIDE; | 55 virtual base::string16 GetAudioInputDeviceModel() OVERRIDE; |
55 | 56 |
56 virtual void ShowAudioInputSettings() OVERRIDE; | 57 virtual void ShowAudioInputSettings() OVERRIDE; |
57 | 58 |
58 virtual void GetAudioInputDeviceNames( | 59 virtual void GetAudioInputDeviceNames( |
59 AudioDeviceNames* device_names) OVERRIDE; | 60 AudioDeviceNames* device_names) OVERRIDE; |
60 | 61 |
61 virtual void GetAudioOutputDeviceNames( | 62 virtual void GetAudioOutputDeviceNames( |
62 AudioDeviceNames* device_names) OVERRIDE; | 63 AudioDeviceNames* device_names) OVERRIDE; |
(...skipping 29 matching lines...) Expand all Loading... |
92 | 93 |
93 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy | 94 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy |
94 // name is also from |AUDIO_PCM_LINEAR|. | 95 // name is also from |AUDIO_PCM_LINEAR|. |
95 virtual AudioInputStream* MakeLinearInputStream( | 96 virtual AudioInputStream* MakeLinearInputStream( |
96 const AudioParameters& params, const std::string& device_id) = 0; | 97 const AudioParameters& params, const std::string& device_id) = 0; |
97 | 98 |
98 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. | 99 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. |
99 virtual AudioInputStream* MakeLowLatencyInputStream( | 100 virtual AudioInputStream* MakeLowLatencyInputStream( |
100 const AudioParameters& params, const std::string& device_id) = 0; | 101 const AudioParameters& params, const std::string& device_id) = 0; |
101 | 102 |
102 // Listeners will be notified on the AudioManager::GetMessageLoop() loop. | 103 // Listeners will be notified on the GetTaskRunner() task runner. |
103 virtual void AddOutputDeviceChangeListener( | 104 virtual void AddOutputDeviceChangeListener( |
104 AudioDeviceListener* listener) OVERRIDE; | 105 AudioDeviceListener* listener) OVERRIDE; |
105 virtual void RemoveOutputDeviceChangeListener( | 106 virtual void RemoveOutputDeviceChangeListener( |
106 AudioDeviceListener* listener) OVERRIDE; | 107 AudioDeviceListener* listener) OVERRIDE; |
107 | 108 |
108 virtual AudioParameters GetDefaultOutputStreamParameters() OVERRIDE; | 109 virtual AudioParameters GetDefaultOutputStreamParameters() OVERRIDE; |
109 virtual AudioParameters GetOutputStreamParameters( | 110 virtual AudioParameters GetOutputStreamParameters( |
110 const std::string& device_id) OVERRIDE; | 111 const std::string& device_id) OVERRIDE; |
111 | 112 |
112 virtual AudioParameters GetInputStreamParameters( | 113 virtual AudioParameters GetInputStreamParameters( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 181 |
181 // Number of currently open input streams. | 182 // Number of currently open input streams. |
182 int num_input_streams_; | 183 int num_input_streams_; |
183 | 184 |
184 // Track output state change listeners. | 185 // Track output state change listeners. |
185 ObserverList<AudioDeviceListener> output_listeners_; | 186 ObserverList<AudioDeviceListener> output_listeners_; |
186 | 187 |
187 // Thread used to interact with audio streams created by this audio manager. | 188 // Thread used to interact with audio streams created by this audio manager. |
188 base::Thread audio_thread_; | 189 base::Thread audio_thread_; |
189 | 190 |
190 // The message loop of the audio thread this object runs on. Used for internal | 191 // The task runner of the audio thread this object runs on. Used for internal |
191 // tasks which run on the audio thread even after Shutdown() has been started | 192 // tasks which run on the audio thread even after Shutdown() has been started |
192 // and GetMessageLoop() starts returning NULL. | 193 // and GetTaskRunner() starts returning NULL. |
193 scoped_refptr<base::MessageLoopProxy> message_loop_; | 194 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
194 | 195 |
195 // Map of cached AudioOutputDispatcher instances. Must only be touched | 196 // Map of cached AudioOutputDispatcher instances. Must only be touched |
196 // from the audio thread (no locking). | 197 // from the audio thread (no locking). |
197 AudioOutputDispatchers output_dispatchers_; | 198 AudioOutputDispatchers output_dispatchers_; |
198 | 199 |
199 // Proxy for creating AudioLog objects. | 200 // Proxy for creating AudioLog objects. |
200 AudioLogFactory* const audio_log_factory_; | 201 AudioLogFactory* const audio_log_factory_; |
201 | 202 |
202 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 203 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
203 }; | 204 }; |
204 | 205 |
205 } // namespace media | 206 } // namespace media |
206 | 207 |
207 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 208 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |