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_MAC_AUDIO_MANAGER_MAC_H_ | 5 #ifndef MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ |
6 #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ | 6 #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ |
7 | 7 |
8 #include <AudioUnit/AudioUnit.h> | 8 #include <AudioUnit/AudioUnit.h> |
9 #include <CoreAudio/AudioHardware.h> | 9 #include <CoreAudio/AudioHardware.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace media { | 22 namespace media { |
23 | 23 |
24 class AUAudioInputStream; | 24 class AUAudioInputStream; |
25 class AUHALStream; | 25 class AUHALStream; |
26 | 26 |
27 // Mac OS X implementation of the AudioManager singleton. This class is internal | 27 // Mac OS X implementation of the AudioManager singleton. This class is internal |
28 // to the audio output and only internal users can call methods not exposed by | 28 // to the audio output and only internal users can call methods not exposed by |
29 // the AudioManager class. | 29 // the AudioManager class. |
30 class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase { | 30 class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase { |
31 public: | 31 public: |
32 AudioManagerMac( | 32 AudioManagerMac(std::unique_ptr<AudioThread> audio_thread, |
33 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 33 AudioLogFactory* audio_log_factory); |
34 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 34 ~AudioManagerMac() override; |
35 AudioLogFactory* audio_log_factory); | |
36 | 35 |
37 // Implementation of AudioManager. | 36 // Implementation of AudioManager. |
38 bool HasAudioOutputDevices() override; | 37 bool HasAudioOutputDevices() override; |
39 bool HasAudioInputDevices() override; | 38 bool HasAudioInputDevices() override; |
40 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; | 39 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; |
41 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; | 40 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; |
42 AudioParameters GetInputStreamParameters( | 41 AudioParameters GetInputStreamParameters( |
43 const std::string& device_id) override; | 42 const std::string& device_id) override; |
44 std::string GetAssociatedOutputDeviceID( | 43 std::string GetAssociatedOutputDeviceID( |
45 const std::string& input_device_id) override; | 44 const std::string& input_device_id) override; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 size_t* io_buffer_frame_size); | 113 size_t* io_buffer_frame_size); |
115 | 114 |
116 // Number of constructed output and input streams. | 115 // Number of constructed output and input streams. |
117 size_t output_streams() const { return output_streams_.size(); } | 116 size_t output_streams() const { return output_streams_.size(); } |
118 size_t low_latency_input_streams() const { | 117 size_t low_latency_input_streams() const { |
119 return low_latency_input_streams_.size(); | 118 return low_latency_input_streams_.size(); |
120 } | 119 } |
121 size_t basic_input_streams() const { return basic_input_streams_.size(); } | 120 size_t basic_input_streams() const { return basic_input_streams_.size(); } |
122 | 121 |
123 protected: | 122 protected: |
124 ~AudioManagerMac() override; | |
125 AudioParameters GetPreferredOutputStreamParameters( | 123 AudioParameters GetPreferredOutputStreamParameters( |
126 const std::string& output_device_id, | 124 const std::string& output_device_id, |
127 const AudioParameters& input_params) override; | 125 const AudioParameters& input_params) override; |
| 126 void ShutdownOnAudioThread() override; |
128 | 127 |
129 private: | 128 private: |
130 void InitializeOnAudioThread(); | 129 void InitializeOnAudioThread(); |
131 | 130 |
132 int ChooseBufferSize(bool is_input, int sample_rate); | 131 int ChooseBufferSize(bool is_input, int sample_rate); |
133 | 132 |
134 // Notify streams of a device change if the default output device or its | 133 // Notify streams of a device change if the default output device or its |
135 // sample rate has changed, otherwise does nothing. | 134 // sample rate has changed, otherwise does nothing. |
136 void HandleDeviceChanges(); | 135 void HandleDeviceChanges(); |
137 | 136 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Set to true in the destructor. Ensures that methods that touches native | 181 // Set to true in the destructor. Ensures that methods that touches native |
183 // Core Audio APIs are not executed during shutdown. | 182 // Core Audio APIs are not executed during shutdown. |
184 bool in_shutdown_; | 183 bool in_shutdown_; |
185 | 184 |
186 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); | 185 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); |
187 }; | 186 }; |
188 | 187 |
189 } // namespace media | 188 } // namespace media |
190 | 189 |
191 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ | 190 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ |
OLD | NEW |