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 |
| 28 namespace base { |
| 29 class FilePath; |
| 30 } |
| 31 |
27 namespace media { | 32 namespace media { |
28 | 33 |
29 class AudioOutputDispatcher; | 34 class AudioOutputDispatcher; |
30 | 35 |
31 // AudioManagerBase provides AudioManager functions common for all platforms. | 36 // AudioManagerBase provides AudioManager functions common for all platforms. |
32 class MEDIA_EXPORT AudioManagerBase : public AudioManager { | 37 class MEDIA_EXPORT AudioManagerBase : public AudioManager { |
33 public: | 38 public: |
34 ~AudioManagerBase() override; | 39 ~AudioManagerBase() override; |
35 | 40 |
36 // AudioManager: | 41 // AudioManager: |
(...skipping 23 matching lines...) Expand all Loading... |
60 | 65 |
61 AudioParameters GetDefaultOutputStreamParameters() override; | 66 AudioParameters GetDefaultOutputStreamParameters() override; |
62 AudioParameters GetOutputStreamParameters( | 67 AudioParameters GetOutputStreamParameters( |
63 const std::string& device_id) override; | 68 const std::string& device_id) override; |
64 AudioParameters GetInputStreamParameters( | 69 AudioParameters GetInputStreamParameters( |
65 const std::string& device_id) override; | 70 const std::string& device_id) override; |
66 std::string GetAssociatedOutputDeviceID( | 71 std::string GetAssociatedOutputDeviceID( |
67 const std::string& input_device_id) override; | 72 const std::string& input_device_id) override; |
68 std::unique_ptr<AudioLog> CreateAudioLog( | 73 std::unique_ptr<AudioLog> CreateAudioLog( |
69 AudioLogFactory::AudioComponent component) override; | 74 AudioLogFactory::AudioComponent component) override; |
| 75 void InitializeOutputDebugRecording( |
| 76 AudioFileWriter::CreateCallback create_audio_file_writer_callback) final; |
| 77 void EnableOutputDebugRecording(const base::FilePath& base_file_name) final; |
| 78 void DisableOutputDebugRecording() final; |
70 | 79 |
71 void SetMaxStreamCountForTesting(int max_input, int max_output) final; | 80 void SetMaxStreamCountForTesting(int max_input, int max_output) final; |
72 | 81 |
73 // AudioManagerBase: | 82 // AudioManagerBase: |
74 | 83 |
75 // Called internally by the audio stream when it has been closed. | 84 // Called internally by the audio stream when it has been closed. |
76 virtual void ReleaseOutputStream(AudioOutputStream* stream); | 85 virtual void ReleaseOutputStream(AudioOutputStream* stream); |
77 virtual void ReleaseInputStream(AudioInputStream* stream); | 86 virtual void ReleaseInputStream(AudioInputStream* stream); |
78 | 87 |
79 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy | 88 // 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); | 155 virtual void GetAudioInputDeviceNames(AudioDeviceNames* device_names); |
147 | 156 |
148 // Appends a list of available output devices to |device_names|, | 157 // Appends a list of available output devices to |device_names|, |
149 // which must initially be empty. | 158 // which must initially be empty. |
150 virtual void GetAudioOutputDeviceNames(AudioDeviceNames* device_names); | 159 virtual void GetAudioOutputDeviceNames(AudioDeviceNames* device_names); |
151 | 160 |
152 // Returns the ID of the default audio output device. | 161 // Returns the ID of the default audio output device. |
153 // Implementations that don't yet support this should return an empty string. | 162 // Implementations that don't yet support this should return an empty string. |
154 virtual std::string GetDefaultOutputDeviceID(); | 163 virtual std::string GetDefaultOutputDeviceID(); |
155 | 164 |
| 165 virtual std::unique_ptr<AudioDebugRecordingManager> |
| 166 CreateAudioDebugRecordingManager( |
| 167 AudioFileWriter::CreateCallback create_audio_file_writer_callback, |
| 168 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 169 |
156 private: | 170 private: |
| 171 FRIEND_TEST_ALL_PREFIXES(AudioManagerTest, AudioDebugRecording); |
| 172 |
157 struct DispatcherParams; | 173 struct DispatcherParams; |
158 typedef ScopedVector<DispatcherParams> AudioOutputDispatchers; | 174 typedef ScopedVector<DispatcherParams> AudioOutputDispatchers; |
159 | 175 |
160 class CompareByParams; | 176 class CompareByParams; |
161 | 177 |
162 // These functions assign group ids to devices based on their device ids. | 178 // These functions assign group ids to devices based on their device ids. |
163 // The default implementation is an attempt to do this based on | 179 // The default implementation is an attempt to do this based on |
164 // GetAssociatedOutputDeviceID. Must be called on the audio worker thread | 180 // GetAssociatedOutputDeviceID. Must be called on the audio worker thread |
165 // (see GetTaskRunner()). | 181 // (see GetTaskRunner()). |
166 std::string GetGroupIDOutput(const std::string& output_device_id); | 182 std::string GetGroupIDOutput(const std::string& output_device_id); |
(...skipping 15 matching lines...) Expand all Loading... |
182 // Contains currently open input streams. | 198 // Contains currently open input streams. |
183 std::unordered_set<AudioInputStream*> input_streams_; | 199 std::unordered_set<AudioInputStream*> input_streams_; |
184 | 200 |
185 // Map of cached AudioOutputDispatcher instances. Must only be touched | 201 // Map of cached AudioOutputDispatcher instances. Must only be touched |
186 // from the audio thread (no locking). | 202 // from the audio thread (no locking). |
187 AudioOutputDispatchers output_dispatchers_; | 203 AudioOutputDispatchers output_dispatchers_; |
188 | 204 |
189 // Proxy for creating AudioLog objects. | 205 // Proxy for creating AudioLog objects. |
190 AudioLogFactory* const audio_log_factory_; | 206 AudioLogFactory* const audio_log_factory_; |
191 | 207 |
| 208 // Debug recording manager. |
| 209 std::unique_ptr<AudioDebugRecordingManager> debug_recording_manager_; |
| 210 |
192 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 211 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
193 }; | 212 }; |
194 | 213 |
195 } // namespace media | 214 } // namespace media |
196 | 215 |
197 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 216 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |