| 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> |
| 11 |
| 11 #include <list> | 12 #include <list> |
| 13 #include <memory> |
| 12 #include <string> | 14 #include <string> |
| 13 | 15 |
| 14 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 17 #include "base/macros.h" |
| 16 #include "media/audio/audio_manager_base.h" | 18 #include "media/audio/audio_manager_base.h" |
| 17 #include "media/audio/mac/audio_device_listener_mac.h" | 19 #include "media/audio/mac/audio_device_listener_mac.h" |
| 18 | 20 |
| 19 namespace media { | 21 namespace media { |
| 20 | 22 |
| 21 class AUAudioInputStream; | 23 class AUAudioInputStream; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 120 |
| 119 private: | 121 private: |
| 120 void InitializeOnAudioThread(); | 122 void InitializeOnAudioThread(); |
| 121 | 123 |
| 122 int ChooseBufferSize(bool is_input, int sample_rate); | 124 int ChooseBufferSize(bool is_input, int sample_rate); |
| 123 | 125 |
| 124 // Notify streams of a device change if the default output device or its | 126 // Notify streams of a device change if the default output device or its |
| 125 // sample rate has changed, otherwise does nothing. | 127 // sample rate has changed, otherwise does nothing. |
| 126 void HandleDeviceChanges(); | 128 void HandleDeviceChanges(); |
| 127 | 129 |
| 128 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; | 130 std::unique_ptr<AudioDeviceListenerMac> output_device_listener_; |
| 129 | 131 |
| 130 // Track the output sample-rate and the default output device | 132 // Track the output sample-rate and the default output device |
| 131 // so we can intelligently handle device notifications only when necessary. | 133 // so we can intelligently handle device notifications only when necessary. |
| 132 int current_sample_rate_; | 134 int current_sample_rate_; |
| 133 AudioDeviceID current_output_device_; | 135 AudioDeviceID current_output_device_; |
| 134 | 136 |
| 135 // Helper class which monitors power events to determine if output streams | 137 // Helper class which monitors power events to determine if output streams |
| 136 // should defer Start() calls. Required to workaround an OSX bug. See | 138 // should defer Start() calls. Required to workaround an OSX bug. See |
| 137 // http://crbug.com/160920 for more details. | 139 // http://crbug.com/160920 for more details. |
| 138 class AudioPowerObserver; | 140 class AudioPowerObserver; |
| 139 scoped_ptr<AudioPowerObserver> power_observer_; | 141 std::unique_ptr<AudioPowerObserver> power_observer_; |
| 140 | 142 |
| 141 // Tracks all constructed input and output streams. | 143 // Tracks all constructed input and output streams. |
| 142 // TODO(alokp): We used to track these streams to close before destruction. | 144 // TODO(alokp): We used to track these streams to close before destruction. |
| 143 // We no longer close the streams, so we may be able to get rid of these | 145 // We no longer close the streams, so we may be able to get rid of these |
| 144 // member variables. They are currently used by MaybeChangeBufferSize(). | 146 // member variables. They are currently used by MaybeChangeBufferSize(). |
| 145 // Investigate if we can remove these. | 147 // Investigate if we can remove these. |
| 146 std::list<AudioInputStream*> basic_input_streams_; | 148 std::list<AudioInputStream*> basic_input_streams_; |
| 147 std::list<AUAudioInputStream*> low_latency_input_streams_; | 149 std::list<AUAudioInputStream*> low_latency_input_streams_; |
| 148 std::list<AUHALStream*> output_streams_; | 150 std::list<AUHALStream*> output_streams_; |
| 149 | 151 |
| 150 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); | 152 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); |
| 151 }; | 153 }; |
| 152 | 154 |
| 153 } // namespace media | 155 } // namespace media |
| 154 | 156 |
| 155 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ | 157 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ |
| OLD | NEW |