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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace webrtc { | 29 namespace webrtc { |
30 | 30 |
31 // AudioManager::JavaAudioManager implementation | 31 // AudioManager::JavaAudioManager implementation |
32 AudioManager::JavaAudioManager::JavaAudioManager( | 32 AudioManager::JavaAudioManager::JavaAudioManager( |
33 NativeRegistration* native_reg, | 33 NativeRegistration* native_reg, |
34 std::unique_ptr<GlobalRef> audio_manager) | 34 std::unique_ptr<GlobalRef> audio_manager) |
35 : audio_manager_(std::move(audio_manager)), | 35 : audio_manager_(std::move(audio_manager)), |
36 init_(native_reg->GetMethodId("init", "()Z")), | 36 init_(native_reg->GetMethodId("init", "()Z")), |
37 dispose_(native_reg->GetMethodId("dispose", "()V")), | 37 dispose_(native_reg->GetMethodId("dispose", "()V")), |
38 set_communication_mode_( | |
39 native_reg->GetMethodId("setCommunicationMode", "(Z)V")), | |
40 is_communication_mode_enabled_( | 38 is_communication_mode_enabled_( |
41 native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")), | 39 native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")), |
42 is_device_blacklisted_for_open_sles_usage_( | 40 is_device_blacklisted_for_open_sles_usage_( |
43 native_reg->GetMethodId("isDeviceBlacklistedForOpenSLESUsage", | 41 native_reg->GetMethodId("isDeviceBlacklistedForOpenSLESUsage", |
44 "()Z")) { | 42 "()Z")) { |
45 ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str()); | 43 ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str()); |
46 } | 44 } |
47 | 45 |
48 AudioManager::JavaAudioManager::~JavaAudioManager() { | 46 AudioManager::JavaAudioManager::~JavaAudioManager() { |
49 ALOGD("JavaAudioManager::dtor%s", GetThreadInfo().c_str()); | 47 ALOGD("JavaAudioManager::dtor%s", GetThreadInfo().c_str()); |
50 } | 48 } |
51 | 49 |
52 bool AudioManager::JavaAudioManager::Init() { | 50 bool AudioManager::JavaAudioManager::Init() { |
53 return audio_manager_->CallBooleanMethod(init_); | 51 return audio_manager_->CallBooleanMethod(init_); |
54 } | 52 } |
55 | 53 |
56 void AudioManager::JavaAudioManager::Close() { | 54 void AudioManager::JavaAudioManager::Close() { |
57 audio_manager_->CallVoidMethod(dispose_); | 55 audio_manager_->CallVoidMethod(dispose_); |
58 } | 56 } |
59 | 57 |
60 void AudioManager::JavaAudioManager::SetCommunicationMode(bool enable) { | |
61 audio_manager_->CallVoidMethod(set_communication_mode_, | |
62 static_cast<jboolean>(enable)); | |
63 } | |
64 | |
65 bool AudioManager::JavaAudioManager::IsCommunicationModeEnabled() { | 58 bool AudioManager::JavaAudioManager::IsCommunicationModeEnabled() { |
66 return audio_manager_->CallBooleanMethod(is_communication_mode_enabled_); | 59 return audio_manager_->CallBooleanMethod(is_communication_mode_enabled_); |
67 } | 60 } |
68 | 61 |
69 bool AudioManager::JavaAudioManager::IsDeviceBlacklistedForOpenSLESUsage() { | 62 bool AudioManager::JavaAudioManager::IsDeviceBlacklistedForOpenSLESUsage() { |
70 return audio_manager_->CallBooleanMethod( | 63 return audio_manager_->CallBooleanMethod( |
71 is_device_blacklisted_for_open_sles_usage_); | 64 is_device_blacklisted_for_open_sles_usage_); |
72 } | 65 } |
73 | 66 |
74 // AudioManager implementation | 67 // AudioManager implementation |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 bool AudioManager::Close() { | 169 bool AudioManager::Close() { |
177 ALOGD("Close%s", GetThreadInfo().c_str()); | 170 ALOGD("Close%s", GetThreadInfo().c_str()); |
178 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 171 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
179 if (!initialized_) | 172 if (!initialized_) |
180 return true; | 173 return true; |
181 j_audio_manager_->Close(); | 174 j_audio_manager_->Close(); |
182 initialized_ = false; | 175 initialized_ = false; |
183 return true; | 176 return true; |
184 } | 177 } |
185 | 178 |
186 void AudioManager::SetCommunicationMode(bool enable) { | |
187 ALOGD("SetCommunicationMode(%d)", enable); | |
188 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | |
189 j_audio_manager_->SetCommunicationMode(enable); | |
190 } | |
191 | |
192 bool AudioManager::IsCommunicationModeEnabled() const { | 179 bool AudioManager::IsCommunicationModeEnabled() const { |
193 ALOGD("IsCommunicationModeEnabled()"); | 180 ALOGD("IsCommunicationModeEnabled()"); |
194 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 181 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
195 return j_audio_manager_->IsCommunicationModeEnabled(); | 182 return j_audio_manager_->IsCommunicationModeEnabled(); |
196 } | 183 } |
197 | 184 |
198 bool AudioManager::IsAcousticEchoCancelerSupported() const { | 185 bool AudioManager::IsAcousticEchoCancelerSupported() const { |
199 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 186 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
200 return hardware_aec_; | 187 return hardware_aec_; |
201 } | 188 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 return playout_parameters_; | 288 return playout_parameters_; |
302 } | 289 } |
303 | 290 |
304 const AudioParameters& AudioManager::GetRecordAudioParameters() { | 291 const AudioParameters& AudioManager::GetRecordAudioParameters() { |
305 RTC_CHECK(record_parameters_.is_valid()); | 292 RTC_CHECK(record_parameters_.is_valid()); |
306 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 293 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
307 return record_parameters_; | 294 return record_parameters_; |
308 } | 295 } |
309 | 296 |
310 } // namespace webrtc | 297 } // namespace webrtc |
OLD | NEW |