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> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "media/audio/audio_debug_recording_manager.h" |
19 #include "media/audio/audio_device_name.h" | 20 #include "media/audio/audio_device_name.h" |
20 #include "media/audio/audio_manager.h" | 21 #include "media/audio/audio_manager.h" |
21 #include "media/audio/audio_output_dispatcher.h" | 22 #include "media/audio/audio_output_dispatcher.h" |
22 | 23 |
23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
24 #include "base/win/scoped_com_initializer.h" | 25 #include "base/win/scoped_com_initializer.h" |
25 #endif | 26 #endif |
26 | 27 |
27 namespace media { | 28 namespace media { |
28 | 29 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 61 |
61 AudioParameters GetDefaultOutputStreamParameters() override; | 62 AudioParameters GetDefaultOutputStreamParameters() override; |
62 AudioParameters GetOutputStreamParameters( | 63 AudioParameters GetOutputStreamParameters( |
63 const std::string& device_id) override; | 64 const std::string& device_id) override; |
64 AudioParameters GetInputStreamParameters( | 65 AudioParameters GetInputStreamParameters( |
65 const std::string& device_id) override; | 66 const std::string& device_id) override; |
66 std::string GetAssociatedOutputDeviceID( | 67 std::string GetAssociatedOutputDeviceID( |
67 const std::string& input_device_id) override; | 68 const std::string& input_device_id) override; |
68 std::unique_ptr<AudioLog> CreateAudioLog( | 69 std::unique_ptr<AudioLog> CreateAudioLog( |
69 AudioLogFactory::AudioComponent component) override; | 70 AudioLogFactory::AudioComponent component) override; |
| 71 void EnableOutputDebugRecording(const base::FilePath& base_file_name) final; |
| 72 void DisableOutputDebugRecording() final; |
70 | 73 |
71 void SetMaxStreamCountForTesting(int max_input, int max_output) final; | 74 void SetMaxStreamCountForTesting(int max_input, int max_output) final; |
72 | 75 |
73 // AudioManagerBase: | 76 // AudioManagerBase: |
74 | 77 |
75 // Called internally by the audio stream when it has been closed. | 78 // Called internally by the audio stream when it has been closed. |
76 virtual void ReleaseOutputStream(AudioOutputStream* stream); | 79 virtual void ReleaseOutputStream(AudioOutputStream* stream); |
77 virtual void ReleaseInputStream(AudioInputStream* stream); | 80 virtual void ReleaseInputStream(AudioInputStream* stream); |
78 | 81 |
79 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy | 82 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 virtual void GetAudioInputDeviceNames(AudioDeviceNames* device_names); | 149 virtual void GetAudioInputDeviceNames(AudioDeviceNames* device_names); |
147 | 150 |
148 // Appends a list of available output devices to |device_names|, | 151 // Appends a list of available output devices to |device_names|, |
149 // which must initially be empty. | 152 // which must initially be empty. |
150 virtual void GetAudioOutputDeviceNames(AudioDeviceNames* device_names); | 153 virtual void GetAudioOutputDeviceNames(AudioDeviceNames* device_names); |
151 | 154 |
152 // Returns the ID of the default audio output device. | 155 // Returns the ID of the default audio output device. |
153 // Implementations that don't yet support this should return an empty string. | 156 // Implementations that don't yet support this should return an empty string. |
154 virtual std::string GetDefaultOutputDeviceID(); | 157 virtual std::string GetDefaultOutputDeviceID(); |
155 | 158 |
| 159 virtual std::unique_ptr<AudioDebugRecordingManager> |
| 160 CreateAudioDebugRecordingManager( |
| 161 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 162 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); |
| 163 |
156 private: | 164 private: |
| 165 FRIEND_TEST_ALL_PREFIXES(AudioManagerTest, AudioDebugRecording); |
| 166 |
157 struct DispatcherParams; | 167 struct DispatcherParams; |
158 typedef ScopedVector<DispatcherParams> AudioOutputDispatchers; | 168 typedef ScopedVector<DispatcherParams> AudioOutputDispatchers; |
159 | 169 |
160 class CompareByParams; | 170 class CompareByParams; |
161 | 171 |
| 172 // AudioManager: |
| 173 void InitializeOutputDebugRecording( |
| 174 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) final; |
| 175 |
162 // These functions assign group ids to devices based on their device ids. | 176 // These functions assign group ids to devices based on their device ids. |
163 // The default implementation is an attempt to do this based on | 177 // The default implementation is an attempt to do this based on |
164 // GetAssociatedOutputDeviceID. Must be called on the audio worker thread | 178 // GetAssociatedOutputDeviceID. Must be called on the audio worker thread |
165 // (see GetTaskRunner()). | 179 // (see GetTaskRunner()). |
166 std::string GetGroupIDOutput(const std::string& output_device_id); | 180 std::string GetGroupIDOutput(const std::string& output_device_id); |
167 std::string GetGroupIDInput(const std::string& input_device_id); | 181 std::string GetGroupIDInput(const std::string& input_device_id); |
168 | 182 |
169 // Max number of open output streams, modified by | 183 // Max number of open output streams, modified by |
170 // SetMaxOutputStreamsAllowed(). | 184 // SetMaxOutputStreamsAllowed(). |
171 int max_num_output_streams_; | 185 int max_num_output_streams_; |
(...skipping 10 matching lines...) Expand all Loading... |
182 // Contains currently open input streams. | 196 // Contains currently open input streams. |
183 std::unordered_set<AudioInputStream*> input_streams_; | 197 std::unordered_set<AudioInputStream*> input_streams_; |
184 | 198 |
185 // Map of cached AudioOutputDispatcher instances. Must only be touched | 199 // Map of cached AudioOutputDispatcher instances. Must only be touched |
186 // from the audio thread (no locking). | 200 // from the audio thread (no locking). |
187 AudioOutputDispatchers output_dispatchers_; | 201 AudioOutputDispatchers output_dispatchers_; |
188 | 202 |
189 // Proxy for creating AudioLog objects. | 203 // Proxy for creating AudioLog objects. |
190 AudioLogFactory* const audio_log_factory_; | 204 AudioLogFactory* const audio_log_factory_; |
191 | 205 |
| 206 // Debug recording manager. |
| 207 std::unique_ptr<AudioDebugRecordingManager> debug_recording_manager_; |
| 208 |
192 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 209 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
193 }; | 210 }; |
194 | 211 |
195 } // namespace media | 212 } // namespace media |
196 | 213 |
197 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 214 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |