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