Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: media/audio/audio_manager_base.h

Issue 1780333007: AudioManagerBase: Create and run the audio thread lazily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // default playback device. At the moment this feature is supported only on 45 // default playback device. At the moment this feature is supported only on
46 // some platforms. AudioInputStream::Intialize() will return an error on 46 // some platforms. AudioInputStream::Intialize() will return an error on
47 // platforms that don't support it. GetInputStreamParameters() must be used 47 // platforms that don't support it. GetInputStreamParameters() must be used
48 // to get the parameters of the loopback device before creating a loopback 48 // to get the parameters of the loopback device before creating a loopback
49 // stream, otherwise stream initialization may fail. 49 // stream, otherwise stream initialization may fail.
50 static const char kLoopbackInputDeviceId[]; 50 static const char kLoopbackInputDeviceId[];
51 51
52 ~AudioManagerBase() override; 52 ~AudioManagerBase() override;
53 53
54 // AudioManager: 54 // AudioManager:
55 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() const override; 55 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override;
56 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override; 56 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override;
57 base::string16 GetAudioInputDeviceModel() override; 57 base::string16 GetAudioInputDeviceModel() override;
58 void ShowAudioInputSettings() override; 58 void ShowAudioInputSettings() override;
59 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 59 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
60 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 60 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
61 AudioOutputStream* MakeAudioOutputStream( 61 AudioOutputStream* MakeAudioOutputStream(
62 const AudioParameters& params, 62 const AudioParameters& params,
63 const std::string& device_id) override; 63 const std::string& device_id) override;
64 AudioInputStream* MakeAudioInputStream(const AudioParameters& params, 64 AudioInputStream* MakeAudioInputStream(const AudioParameters& params,
65 const std::string& device_id) override; 65 const std::string& device_id) override;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Number of currently open output streams. 164 // Number of currently open output streams.
165 int num_output_streams_; 165 int num_output_streams_;
166 166
167 // Number of currently open input streams. 167 // Number of currently open input streams.
168 int num_input_streams_; 168 int num_input_streams_;
169 169
170 // Track output state change listeners. 170 // Track output state change listeners.
171 base::ObserverList<AudioDeviceListener> output_listeners_; 171 base::ObserverList<AudioDeviceListener> output_listeners_;
172 172
173 // Thread used to interact with audio streams created by this audio manager. 173 // Thread used to interact with audio streams created by this audio manager.
174 base::Thread audio_thread_; 174 scoped_ptr<base::Thread> audio_thread_;
175
176 // The task runner of the audio thread this object runs on. Used for internal
177 // tasks which run on the audio thread even after Shutdown() has been started
178 // and GetTaskRunner() starts returning NULL.
179 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
180 175
181 // Map of cached AudioOutputDispatcher instances. Must only be touched 176 // Map of cached AudioOutputDispatcher instances. Must only be touched
182 // from the audio thread (no locking). 177 // from the audio thread (no locking).
183 AudioOutputDispatchers output_dispatchers_; 178 AudioOutputDispatchers output_dispatchers_;
184 179
185 // Proxy for creating AudioLog objects. 180 // Proxy for creating AudioLog objects.
186 AudioLogFactory* const audio_log_factory_; 181 AudioLogFactory* const audio_log_factory_;
187 182
188 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); 183 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
189 }; 184 };
190 185
191 } // namespace media 186 } // namespace media
192 187
193 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 188 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698