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 class AUHALStream; | 22 class AUHALStream; |
23 | 23 |
24 // Mac OS X implementation of the AudioManager singleton. This class is internal | 24 // Mac OS X implementation of the AudioManager singleton. This class is internal |
25 // to the audio output and only internal users can call methods not exposed by | 25 // to the audio output and only internal users can call methods not exposed by |
26 // the AudioManager class. | 26 // the AudioManager class. |
27 class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase { | 27 class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase { |
28 public: | 28 public: |
29 AudioManagerMac(AudioLogFactory* audio_log_factory); | 29 AudioManagerMac(AudioLogFactory* audio_log_factory); |
30 | 30 |
31 // Implementation of AudioManager. | 31 // Implementation of AudioManager. |
| 32 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; |
| 33 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override; |
32 bool HasAudioOutputDevices() override; | 34 bool HasAudioOutputDevices() override; |
33 bool HasAudioInputDevices() override; | 35 bool HasAudioInputDevices() override; |
34 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; | 36 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; |
35 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; | 37 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; |
36 AudioParameters GetInputStreamParameters( | 38 AudioParameters GetInputStreamParameters( |
37 const std::string& device_id) override; | 39 const std::string& device_id) override; |
38 std::string GetAssociatedOutputDeviceID( | 40 std::string GetAssociatedOutputDeviceID( |
39 const std::string& input_device_id) override; | 41 const std::string& input_device_id) override; |
40 | 42 |
41 // Implementation of AudioManagerBase. | 43 // Implementation of AudioManagerBase. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void ShutdownOnAudioThread(); | 117 void ShutdownOnAudioThread(); |
116 | 118 |
117 int ChooseBufferSize(bool is_input, int sample_rate); | 119 int ChooseBufferSize(bool is_input, int sample_rate); |
118 | 120 |
119 // Notify streams of a device change if the default output device or its | 121 // Notify streams of a device change if the default output device or its |
120 // sample rate has changed, otherwise does nothing. | 122 // sample rate has changed, otherwise does nothing. |
121 void HandleDeviceChanges(); | 123 void HandleDeviceChanges(); |
122 | 124 |
123 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; | 125 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; |
124 | 126 |
| 127 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 128 base::Thread worker_thread_; |
| 129 |
125 // Track the output sample-rate and the default output device | 130 // Track the output sample-rate and the default output device |
126 // so we can intelligently handle device notifications only when necessary. | 131 // so we can intelligently handle device notifications only when necessary. |
127 int current_sample_rate_; | 132 int current_sample_rate_; |
128 AudioDeviceID current_output_device_; | 133 AudioDeviceID current_output_device_; |
129 | 134 |
130 // Helper class which monitors power events to determine if output streams | 135 // Helper class which monitors power events to determine if output streams |
131 // should defer Start() calls. Required to workaround an OSX bug. See | 136 // should defer Start() calls. Required to workaround an OSX bug. See |
132 // http://crbug.com/160920 for more details. | 137 // http://crbug.com/160920 for more details. |
133 class AudioPowerObserver; | 138 class AudioPowerObserver; |
134 scoped_ptr<AudioPowerObserver> power_observer_; | 139 scoped_ptr<AudioPowerObserver> power_observer_; |
135 | 140 |
136 // Tracks all constructed input and output streams so they can be stopped at | 141 // Tracks all constructed input and output streams so they can be stopped at |
137 // shutdown. See ShutdownOnAudioThread() for more details. | 142 // shutdown. See ShutdownOnAudioThread() for more details. |
138 std::list<AudioInputStream*> basic_input_streams_; | 143 std::list<AudioInputStream*> basic_input_streams_; |
139 std::list<AUAudioInputStream*> low_latency_input_streams_; | 144 std::list<AUAudioInputStream*> low_latency_input_streams_; |
140 std::list<AUHALStream*> output_streams_; | 145 std::list<AUHALStream*> output_streams_; |
141 | 146 |
142 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); | 147 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); |
143 }; | 148 }; |
144 | 149 |
145 } // namespace media | 150 } // namespace media |
146 | 151 |
147 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ | 152 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ |
OLD | NEW |