| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 static bool GetDefaultOutputChannels(int* channels); | 50 static bool GetDefaultOutputChannels(int* channels); |
| 51 | 51 |
| 52 static bool GetDeviceChannels(AudioDeviceID device, | 52 static bool GetDeviceChannels(AudioDeviceID device, |
| 53 AudioObjectPropertyScope scope, | 53 AudioObjectPropertyScope scope, |
| 54 int* channels); | 54 int* channels); |
| 55 | 55 |
| 56 static int HardwareSampleRateForDevice(AudioDeviceID device_id); | 56 static int HardwareSampleRateForDevice(AudioDeviceID device_id); |
| 57 static int HardwareSampleRate(); | 57 static int HardwareSampleRate(); |
| 58 | 58 |
| 59 // Notify streams of a device change if the default output device or its |
| 60 // sample rate has changed, otherwise does nothing. |
| 61 void HandleDeviceChanges(); |
| 62 |
| 59 protected: | 63 protected: |
| 60 virtual ~AudioManagerMac(); | 64 virtual ~AudioManagerMac(); |
| 61 | 65 |
| 62 virtual AudioParameters GetPreferredOutputStreamParameters( | 66 virtual AudioParameters GetPreferredOutputStreamParameters( |
| 63 const AudioParameters& input_params) OVERRIDE; | 67 const AudioParameters& input_params) OVERRIDE; |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 bool HasUnifiedDefaultIO(); | 70 bool HasUnifiedDefaultIO(); |
| 67 | 71 |
| 68 // Helper methods for constructing AudioDeviceListenerMac on the audio thread. | 72 // Helper methods for constructing AudioDeviceListenerMac on the audio thread. |
| 69 void CreateDeviceListener(); | 73 void CreateDeviceListener(); |
| 70 void DestroyDeviceListener(); | 74 void DestroyDeviceListener(); |
| 71 void HandleDeviceChanges(); | |
| 72 | 75 |
| 73 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; | 76 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; |
| 74 | 77 |
| 75 // Track the output sample-rate and the default output device | 78 // Track the output sample-rate and the default output device |
| 76 // so we can intelligently handle device notifications only when necessary. | 79 // so we can intelligently handle device notifications only when necessary. |
| 77 int current_sample_rate_; | 80 int current_sample_rate_; |
| 78 AudioDeviceID current_output_device_; | 81 AudioDeviceID current_output_device_; |
| 79 | 82 |
| 80 AggregateDeviceManager aggregate_device_manager_; | 83 AggregateDeviceManager aggregate_device_manager_; |
| 81 | 84 |
| 82 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); | 85 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 } // namespace media | 88 } // namespace media |
| 86 | 89 |
| 87 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ | 90 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ |
| OLD | NEW |