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 <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ~AudioManagerMac() override; | 79 ~AudioManagerMac() override; |
80 | 80 |
81 AudioParameters GetPreferredOutputStreamParameters( | 81 AudioParameters GetPreferredOutputStreamParameters( |
82 const std::string& output_device_id, | 82 const std::string& output_device_id, |
83 const AudioParameters& input_params) override; | 83 const AudioParameters& input_params) override; |
84 | 84 |
85 private: | 85 private: |
86 void InitializeOnAudioThread(); | 86 void InitializeOnAudioThread(); |
87 void ShutdownOnAudioThread(); | 87 void ShutdownOnAudioThread(); |
88 | 88 |
89 int ChooseBufferSize(int output_sample_rate); | 89 int ChooseBufferSize(bool is_input, int sample_rate); |
90 | 90 |
91 // Notify streams of a device change if the default output device or its | 91 // Notify streams of a device change if the default output device or its |
92 // sample rate has changed, otherwise does nothing. | 92 // sample rate has changed, otherwise does nothing. |
93 void HandleDeviceChanges(); | 93 void HandleDeviceChanges(); |
94 | 94 |
95 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; | 95 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; |
96 | 96 |
97 // Track the output sample-rate and the default output device | 97 // Track the output sample-rate and the default output device |
98 // so we can intelligently handle device notifications only when necessary. | 98 // so we can intelligently handle device notifications only when necessary. |
99 int current_sample_rate_; | 99 int current_sample_rate_; |
100 AudioDeviceID current_output_device_; | 100 AudioDeviceID current_output_device_; |
101 | 101 |
102 // Helper class which monitors power events to determine if output streams | 102 // Helper class which monitors power events to determine if output streams |
103 // should defer Start() calls. Required to workaround an OSX bug. See | 103 // should defer Start() calls. Required to workaround an OSX bug. See |
104 // http://crbug.com/160920 for more details. | 104 // http://crbug.com/160920 for more details. |
105 class AudioPowerObserver; | 105 class AudioPowerObserver; |
106 scoped_ptr<AudioPowerObserver> power_observer_; | 106 scoped_ptr<AudioPowerObserver> power_observer_; |
107 | 107 |
108 // Tracks all constructed input and output streams so they can be stopped at | 108 // Tracks all constructed input and output streams so they can be stopped at |
109 // shutdown. See ShutdownOnAudioThread() for more details. | 109 // shutdown. See ShutdownOnAudioThread() for more details. |
110 std::list<AudioInputStream*> input_streams_; | 110 std::list<AudioInputStream*> input_streams_; |
111 std::list<AudioOutputStream*> output_streams_; | 111 std::list<AudioOutputStream*> output_streams_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); | 113 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace media | 116 } // namespace media |
117 | 117 |
118 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ | 118 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ |
OLD | NEW |