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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 const std::string& device_id, | 87 const std::string& device_id, |
88 const LogCallback& log_callback) = 0; | 88 const LogCallback& log_callback) = 0; |
89 | 89 |
90 // Get number of input or output streams. | 90 // Get number of input or output streams. |
91 int input_stream_count() const { | 91 int input_stream_count() const { |
92 return static_cast<int>(input_streams_.size()); | 92 return static_cast<int>(input_streams_.size()); |
93 } | 93 } |
94 int output_stream_count() const { return num_output_streams_; } | 94 int output_stream_count() const { return num_output_streams_; } |
95 | 95 |
96 protected: | 96 protected: |
97 AudioManagerBase( | 97 AudioManagerBase(std::unique_ptr<AudioThread> audio_thread, |
98 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 98 AudioLogFactory* audio_log_factory); |
99 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | |
100 AudioLogFactory* audio_log_factory); | |
101 | 99 |
102 // AudioManager: | 100 // AudioManager: |
| 101 void ShutdownOnAudioThread() override; |
103 base::string16 GetAudioInputDeviceModel() override; | 102 base::string16 GetAudioInputDeviceModel() override; |
104 void ShowAudioInputSettings() override; | 103 void ShowAudioInputSettings() override; |
105 | 104 |
106 void GetAudioInputDeviceDescriptions( | 105 void GetAudioInputDeviceDescriptions( |
107 AudioDeviceDescriptions* device_descriptions) final; | 106 AudioDeviceDescriptions* device_descriptions) final; |
108 void GetAudioOutputDeviceDescriptions( | 107 void GetAudioOutputDeviceDescriptions( |
109 AudioDeviceDescriptions* device_descriptions) final; | 108 AudioDeviceDescriptions* device_descriptions) final; |
110 | 109 |
111 AudioParameters GetDefaultOutputStreamParameters() override; | 110 AudioParameters GetDefaultOutputStreamParameters() override; |
112 AudioParameters GetOutputStreamParameters( | 111 AudioParameters GetOutputStreamParameters( |
113 const std::string& device_id) override; | 112 const std::string& device_id) override; |
114 AudioParameters GetInputStreamParameters( | 113 AudioParameters GetInputStreamParameters( |
115 const std::string& device_id) override; | 114 const std::string& device_id) override; |
116 std::string GetAssociatedOutputDeviceID( | 115 std::string GetAssociatedOutputDeviceID( |
117 const std::string& input_device_id) override; | 116 const std::string& input_device_id) override; |
118 | 117 |
119 // Releases all the audio output dispatchers. | |
120 // All audio streams should be closed before Shutdown() is called. | |
121 // This must be called in the destructor of every AudioManagerBase | |
122 // implementation. | |
123 void Shutdown(); | |
124 | |
125 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } | 118 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } |
126 | 119 |
127 // Called by each platform specific AudioManager to notify output state change | 120 // Called by each platform specific AudioManager to notify output state change |
128 // listeners that a state change has occurred. Must be called from the audio | 121 // listeners that a state change has occurred. Must be called from the audio |
129 // thread. | 122 // thread. |
130 void NotifyAllOutputDeviceChangeListeners(); | 123 void NotifyAllOutputDeviceChangeListeners(); |
131 | 124 |
132 // Returns user buffer size as specified on the command line or 0 if no buffer | 125 // Returns user buffer size as specified on the command line or 0 if no buffer |
133 // size has been specified. | 126 // size has been specified. |
134 static int GetUserBufferSize(); | 127 static int GetUserBufferSize(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 198 |
206 // Debug recording manager. | 199 // Debug recording manager. |
207 std::unique_ptr<AudioDebugRecordingManager> debug_recording_manager_; | 200 std::unique_ptr<AudioDebugRecordingManager> debug_recording_manager_; |
208 | 201 |
209 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 202 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
210 }; | 203 }; |
211 | 204 |
212 } // namespace media | 205 } // namespace media |
213 | 206 |
214 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 207 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |