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 <CoreAudio/AudioHardware.h> | 8 #include <CoreAudio/AudioHardware.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 protected: | 75 protected: |
76 virtual ~AudioManagerMac(); | 76 virtual ~AudioManagerMac(); |
77 | 77 |
78 virtual AudioParameters GetPreferredOutputStreamParameters( | 78 virtual AudioParameters GetPreferredOutputStreamParameters( |
79 const std::string& output_device_id, | 79 const std::string& output_device_id, |
80 const AudioParameters& input_params) OVERRIDE; | 80 const AudioParameters& input_params) OVERRIDE; |
81 | 81 |
82 private: | 82 private: |
83 bool HasUnifiedDefaultIO(); | 83 bool HasUnifiedDefaultIO(); |
84 | 84 void InitializeOnAudioThread(); |
85 // Helper methods for constructing AudioDeviceListenerMac on the audio thread. | 85 void ShutdownOnAudioThread(); |
86 void CreateDeviceListener(); | |
87 void DestroyDeviceListener(); | |
88 | 86 |
89 int ChooseBufferSize(int output_sample_rate); | 87 int ChooseBufferSize(int output_sample_rate); |
90 | 88 |
91 // Notify streams of a device change if the default output device or its | 89 // Notify streams of a device change if the default output device or its |
92 // sample rate has changed, otherwise does nothing. | 90 // sample rate has changed, otherwise does nothing. |
93 void HandleDeviceChanges(); | 91 void HandleDeviceChanges(); |
94 | 92 |
95 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; | 93 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; |
96 | 94 |
97 // Track the output sample-rate and the default output device | 95 // Track the output sample-rate and the default output device |
98 // so we can intelligently handle device notifications only when necessary. | 96 // so we can intelligently handle device notifications only when necessary. |
99 int current_sample_rate_; | 97 int current_sample_rate_; |
100 AudioDeviceID current_output_device_; | 98 AudioDeviceID current_output_device_; |
101 | 99 |
102 AggregateDeviceManager aggregate_device_manager_; | 100 AggregateDeviceManager aggregate_device_manager_; |
103 | 101 |
104 // Helper class which monitors power events to determine if output streams | 102 // Helper class which monitors power events to determine if output streams |
105 // should defer Start() calls. Required to workaround an OSX bug. See | 103 // should defer Start() calls. Required to workaround an OSX bug. See |
106 // http://crbug.com/160920 for more details. | 104 // http://crbug.com/160920 for more details. |
107 class AudioPowerObserver; | 105 class AudioPowerObserver; |
108 scoped_ptr<AudioPowerObserver> power_observer_; | 106 scoped_ptr<AudioPowerObserver> power_observer_; |
109 | 107 |
110 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); | 108 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); |
111 }; | 109 }; |
112 | 110 |
113 } // namespace media | 111 } // namespace media |
114 | 112 |
115 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ | 113 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ |
OLD | NEW |