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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 namespace media { | 28 namespace media { |
29 | 29 |
30 class AudioOutputDispatcher; | 30 class AudioOutputDispatcher; |
31 | 31 |
32 // AudioManagerBase provides AudioManager functions common for all platforms. | 32 // AudioManagerBase provides AudioManager functions common for all platforms. |
33 class MEDIA_EXPORT AudioManagerBase : public AudioManager { | 33 class MEDIA_EXPORT AudioManagerBase : public AudioManager { |
34 public: | 34 public: |
35 ~AudioManagerBase() override; | 35 ~AudioManagerBase() override; |
36 | 36 |
37 // AudioManager: | |
38 base::string16 GetAudioInputDeviceModel() override; | |
39 void ShowAudioInputSettings() override; | |
40 | |
41 void GetAudioInputDeviceDescriptions( | |
42 AudioDeviceDescriptions* device_descriptions) final; | |
43 void GetAudioOutputDeviceDescriptions( | |
44 AudioDeviceDescriptions* device_descriptions) final; | |
45 | |
46 AudioOutputStream* MakeAudioOutputStream( | 37 AudioOutputStream* MakeAudioOutputStream( |
47 const AudioParameters& params, | 38 const AudioParameters& params, |
48 const std::string& device_id, | 39 const std::string& device_id, |
49 const LogCallback& log_callback) override; | 40 const LogCallback& log_callback) override; |
50 AudioInputStream* MakeAudioInputStream( | 41 AudioInputStream* MakeAudioInputStream( |
51 const AudioParameters& params, | 42 const AudioParameters& params, |
52 const std::string& device_id, | 43 const std::string& device_id, |
53 const LogCallback& log_callback) override; | 44 const LogCallback& log_callback) override; |
54 AudioOutputStream* MakeAudioOutputStreamProxy( | 45 AudioOutputStream* MakeAudioOutputStreamProxy( |
55 const AudioParameters& params, | 46 const AudioParameters& params, |
56 const std::string& device_id) override; | 47 const std::string& device_id) override; |
57 | 48 |
58 // Listeners will be notified on the GetTaskRunner() task runner. | 49 // Listeners will be notified on the GetTaskRunner() task runner. |
59 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; | 50 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
60 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; | 51 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override; |
61 | 52 |
62 AudioParameters GetDefaultOutputStreamParameters() override; | |
63 AudioParameters GetOutputStreamParameters( | |
64 const std::string& device_id) override; | |
65 AudioParameters GetInputStreamParameters( | |
66 const std::string& device_id) override; | |
67 std::string GetAssociatedOutputDeviceID( | |
68 const std::string& input_device_id) override; | |
69 std::unique_ptr<AudioLog> CreateAudioLog( | 53 std::unique_ptr<AudioLog> CreateAudioLog( |
70 AudioLogFactory::AudioComponent component) override; | 54 AudioLogFactory::AudioComponent component) override; |
71 void EnableOutputDebugRecording(const base::FilePath& base_file_name) final; | 55 void EnableOutputDebugRecording(const base::FilePath& base_file_name) final; |
72 void DisableOutputDebugRecording() final; | 56 void DisableOutputDebugRecording() final; |
73 | 57 |
74 void SetMaxStreamCountForTesting(int max_input, int max_output) final; | 58 void SetMaxStreamCountForTesting(int max_input, int max_output) final; |
75 | 59 |
76 // AudioManagerBase: | 60 // AudioManagerBase: |
77 | 61 |
78 // Called internally by the audio stream when it has been closed. | 62 // Called internally by the audio stream when it has been closed. |
(...skipping 30 matching lines...) Expand all Loading... |
109 return static_cast<int>(input_streams_.size()); | 93 return static_cast<int>(input_streams_.size()); |
110 } | 94 } |
111 int output_stream_count() const { return num_output_streams_; } | 95 int output_stream_count() const { return num_output_streams_; } |
112 | 96 |
113 protected: | 97 protected: |
114 AudioManagerBase( | 98 AudioManagerBase( |
115 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 99 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
116 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 100 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
117 AudioLogFactory* audio_log_factory); | 101 AudioLogFactory* audio_log_factory); |
118 | 102 |
| 103 // AudioManager: |
| 104 base::string16 GetAudioInputDeviceModel() override; |
| 105 void ShowAudioInputSettings() override; |
| 106 |
| 107 void GetAudioInputDeviceDescriptions( |
| 108 AudioDeviceDescriptions* device_descriptions) final; |
| 109 void GetAudioOutputDeviceDescriptions( |
| 110 AudioDeviceDescriptions* device_descriptions) final; |
| 111 |
| 112 AudioParameters GetDefaultOutputStreamParameters() override; |
| 113 AudioParameters GetOutputStreamParameters( |
| 114 const std::string& device_id) override; |
| 115 AudioParameters GetInputStreamParameters( |
| 116 const std::string& device_id) override; |
| 117 std::string GetAssociatedOutputDeviceID( |
| 118 const std::string& input_device_id) override; |
| 119 |
119 // Releases all the audio output dispatchers. | 120 // Releases all the audio output dispatchers. |
120 // All audio streams should be closed before Shutdown() is called. | 121 // All audio streams should be closed before Shutdown() is called. |
121 // This must be called in the destructor of every AudioManagerBase | 122 // This must be called in the destructor of every AudioManagerBase |
122 // implementation. | 123 // implementation. |
123 void Shutdown(); | 124 void Shutdown(); |
124 | 125 |
125 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } | 126 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } |
126 | 127 |
127 // Called by each platform specific AudioManager to notify output state change | 128 // 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 | 129 // listeners that a state change has occurred. Must be called from the audio |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 206 |
206 // Debug recording manager. | 207 // Debug recording manager. |
207 std::unique_ptr<AudioDebugRecordingManager> debug_recording_manager_; | 208 std::unique_ptr<AudioDebugRecordingManager> debug_recording_manager_; |
208 | 209 |
209 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 210 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
210 }; | 211 }; |
211 | 212 |
212 } // namespace media | 213 } // namespace media |
213 | 214 |
214 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 215 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |