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 |
11 #include "webrtc/modules/audio_device/android/audio_manager.h" | 11 #include "webrtc/modules/audio_device/android/audio_manager.h" |
12 | 12 |
| 13 #include <utility> |
| 14 |
13 #include <android/log.h> | 15 #include <android/log.h> |
14 | 16 |
15 #include "webrtc/base/arraysize.h" | 17 #include "webrtc/base/arraysize.h" |
16 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/scoped_ptr.h" | 19 #include "webrtc/base/scoped_ptr.h" |
18 #include "webrtc/modules/audio_device/android/audio_common.h" | 20 #include "webrtc/modules/audio_device/android/audio_common.h" |
19 #include "webrtc/modules/utility/include/helpers_android.h" | 21 #include "webrtc/modules/utility/include/helpers_android.h" |
20 | 22 |
21 #define TAG "AudioManager" | 23 #define TAG "AudioManager" |
22 #define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) | 24 #define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) |
23 #define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) | 25 #define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) |
24 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) | 26 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) |
25 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) | 27 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) |
26 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) | 28 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) |
27 | 29 |
28 namespace webrtc { | 30 namespace webrtc { |
29 | 31 |
30 // AudioManager::JavaAudioManager implementation | 32 // AudioManager::JavaAudioManager implementation |
31 AudioManager::JavaAudioManager::JavaAudioManager( | 33 AudioManager::JavaAudioManager::JavaAudioManager( |
32 NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_manager) | 34 NativeRegistration* native_reg, |
33 : audio_manager_(audio_manager.Pass()), | 35 rtc::scoped_ptr<GlobalRef> audio_manager) |
| 36 : audio_manager_(std::move(audio_manager)), |
34 init_(native_reg->GetMethodId("init", "()Z")), | 37 init_(native_reg->GetMethodId("init", "()Z")), |
35 dispose_(native_reg->GetMethodId("dispose", "()V")), | 38 dispose_(native_reg->GetMethodId("dispose", "()V")), |
36 is_communication_mode_enabled_( | 39 is_communication_mode_enabled_( |
37 native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")), | 40 native_reg->GetMethodId("isCommunicationModeEnabled", "()Z")), |
38 is_device_blacklisted_for_open_sles_usage_( | 41 is_device_blacklisted_for_open_sles_usage_( |
39 native_reg->GetMethodId( | 42 native_reg->GetMethodId("isDeviceBlacklistedForOpenSLESUsage", |
40 "isDeviceBlacklistedForOpenSLESUsage", "()Z")) { | 43 "()Z")) { |
41 ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str()); | 44 ALOGD("JavaAudioManager::ctor%s", GetThreadInfo().c_str()); |
42 } | 45 } |
43 | 46 |
44 AudioManager::JavaAudioManager::~JavaAudioManager() { | 47 AudioManager::JavaAudioManager::~JavaAudioManager() { |
45 ALOGD("JavaAudioManager::dtor%s", GetThreadInfo().c_str()); | 48 ALOGD("JavaAudioManager::dtor%s", GetThreadInfo().c_str()); |
46 } | 49 } |
47 | 50 |
48 bool AudioManager::JavaAudioManager::Init() { | 51 bool AudioManager::JavaAudioManager::Init() { |
49 return audio_manager_->CallBooleanMethod(init_); | 52 return audio_manager_->CallBooleanMethod(init_); |
50 } | 53 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 return playout_parameters_; | 226 return playout_parameters_; |
224 } | 227 } |
225 | 228 |
226 const AudioParameters& AudioManager::GetRecordAudioParameters() { | 229 const AudioParameters& AudioManager::GetRecordAudioParameters() { |
227 RTC_CHECK(record_parameters_.is_valid()); | 230 RTC_CHECK(record_parameters_.is_valid()); |
228 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 231 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
229 return record_parameters_; | 232 return record_parameters_; |
230 } | 233 } |
231 | 234 |
232 } // namespace webrtc | 235 } // namespace webrtc |
OLD | NEW |