OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // allows calls like JavaAudioManager::Close() while hiding the Java/JNI | 90 // allows calls like JavaAudioManager::Close() while hiding the Java/JNI |
91 // parts that are associated with this call. | 91 // parts that are associated with this call. |
92 class JavaAudioManager { | 92 class JavaAudioManager { |
93 public: | 93 public: |
94 JavaAudioManager(NativeRegistration* native_registration, | 94 JavaAudioManager(NativeRegistration* native_registration, |
95 rtc::scoped_ptr<GlobalRef> audio_manager); | 95 rtc::scoped_ptr<GlobalRef> audio_manager); |
96 ~JavaAudioManager(); | 96 ~JavaAudioManager(); |
97 | 97 |
98 bool Init(); | 98 bool Init(); |
99 void Close(); | 99 void Close(); |
100 void SetCommunicationMode(bool enable); | 100 bool IsCommunicationModeEnabled(); |
101 | 101 |
102 private: | 102 private: |
103 rtc::scoped_ptr<GlobalRef> audio_manager_; | 103 rtc::scoped_ptr<GlobalRef> audio_manager_; |
104 jmethodID init_; | 104 jmethodID init_; |
105 jmethodID dispose_; | 105 jmethodID dispose_; |
106 jmethodID set_communication_mode_; | 106 jmethodID is_communication_mode_enabled_; |
107 }; | 107 }; |
108 | 108 |
109 AudioManager(); | 109 AudioManager(); |
110 ~AudioManager(); | 110 ~AudioManager(); |
111 | 111 |
112 // Sets the currently active audio layer combination. Must be called before | 112 // Sets the currently active audio layer combination. Must be called before |
113 // Init(). | 113 // Init(). |
114 void SetActiveAudioLayer(AudioDeviceModule::AudioLayer audio_layer); | 114 void SetActiveAudioLayer(AudioDeviceModule::AudioLayer audio_layer); |
115 | 115 |
116 // Initializes the audio manager and stores the current audio mode. | 116 // Initializes the audio manager and stores the current audio mode. |
117 bool Init(); | 117 bool Init(); |
118 // Revert any setting done by Init(). | 118 // Revert any setting done by Init(). |
119 bool Close(); | 119 bool Close(); |
120 | 120 |
121 // Sets audio mode to AudioManager.MODE_IN_COMMUNICATION if |enable| is true. | 121 // Returns true if current audio mode is AudioManager.MODE_IN_COMMUNICATION. |
122 // Restores audio mode that was stored in Init() if |enable| is false. | 122 bool IsCommunicationModeEnabled() const; |
123 void SetCommunicationMode(bool enable); | |
124 | 123 |
125 // Native audio parameters stored during construction. | 124 // Native audio parameters stored during construction. |
126 const AudioParameters& GetPlayoutAudioParameters(); | 125 const AudioParameters& GetPlayoutAudioParameters(); |
127 const AudioParameters& GetRecordAudioParameters(); | 126 const AudioParameters& GetRecordAudioParameters(); |
128 | 127 |
129 // Returns true if the device supports a built-in Acoustic Echo Canceler. | 128 // Returns true if the device supports a built-in Acoustic Echo Canceler. |
130 // Some devices can also be blacklisted for use in combination with an AEC | 129 // Some devices can also be blacklisted for use in combination with an AEC |
131 // and these devices will return false. | 130 // and these devices will return false. |
132 // Can currently only be used in combination with a Java based audio backend | 131 // Can currently only be used in combination with a Java based audio backend |
133 // for the recoring side (i.e. using the android.media.AudioRecord API). | 132 // for the recoring side (i.e. using the android.media.AudioRecord API). |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Contains native parameters (e.g. sample rate, channel configuration). | 199 // Contains native parameters (e.g. sample rate, channel configuration). |
201 // Set at construction in OnCacheAudioParameters() which is called from | 200 // Set at construction in OnCacheAudioParameters() which is called from |
202 // Java on the same thread as this object is created on. | 201 // Java on the same thread as this object is created on. |
203 AudioParameters playout_parameters_; | 202 AudioParameters playout_parameters_; |
204 AudioParameters record_parameters_; | 203 AudioParameters record_parameters_; |
205 }; | 204 }; |
206 | 205 |
207 } // namespace webrtc | 206 } // namespace webrtc |
208 | 207 |
209 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_ | 208 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_ |
OLD | NEW |