OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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_record_jni.h" | 11 #include "webrtc/modules/audio_device/android/audio_record_jni.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/format_macros.h" | 19 #include "webrtc/base/format_macros.h" |
18 #include "webrtc/modules/audio_device/android/audio_common.h" | 20 #include "webrtc/modules/audio_device/android/audio_common.h" |
19 | 21 |
20 #define TAG "AudioRecordJni" | 22 #define TAG "AudioRecordJni" |
21 #define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) | 23 #define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) |
22 #define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) | 24 #define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) |
23 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) | 25 #define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) |
24 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) | 26 #define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) |
25 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) | 27 #define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) |
26 | 28 |
27 namespace webrtc { | 29 namespace webrtc { |
28 | 30 |
29 // AudioRecordJni::JavaAudioRecord implementation. | 31 // AudioRecordJni::JavaAudioRecord implementation. |
30 AudioRecordJni::JavaAudioRecord::JavaAudioRecord( | 32 AudioRecordJni::JavaAudioRecord::JavaAudioRecord( |
31 NativeRegistration* native_reg, rtc::scoped_ptr<GlobalRef> audio_record) | 33 NativeRegistration* native_reg, |
32 : audio_record_(audio_record.Pass()), | 34 rtc::scoped_ptr<GlobalRef> audio_record) |
| 35 : audio_record_(std::move(audio_record)), |
33 init_recording_(native_reg->GetMethodId("initRecording", "(II)I")), | 36 init_recording_(native_reg->GetMethodId("initRecording", "(II)I")), |
34 start_recording_(native_reg->GetMethodId("startRecording", "()Z")), | 37 start_recording_(native_reg->GetMethodId("startRecording", "()Z")), |
35 stop_recording_(native_reg->GetMethodId("stopRecording", "()Z")), | 38 stop_recording_(native_reg->GetMethodId("stopRecording", "()Z")), |
36 enable_built_in_aec_(native_reg->GetMethodId( | 39 enable_built_in_aec_(native_reg->GetMethodId("enableBuiltInAEC", "(Z)Z")), |
37 "enableBuiltInAEC", "(Z)Z")), | 40 enable_built_in_agc_(native_reg->GetMethodId("enableBuiltInAGC", "(Z)Z")), |
38 enable_built_in_agc_(native_reg->GetMethodId( | 41 enable_built_in_ns_(native_reg->GetMethodId("enableBuiltInNS", "(Z)Z")) {} |
39 "enableBuiltInAGC", "(Z)Z")), | |
40 enable_built_in_ns_(native_reg->GetMethodId( | |
41 "enableBuiltInNS", "(Z)Z")) { | |
42 } | |
43 | 42 |
44 AudioRecordJni::JavaAudioRecord::~JavaAudioRecord() {} | 43 AudioRecordJni::JavaAudioRecord::~JavaAudioRecord() {} |
45 | 44 |
46 int AudioRecordJni::JavaAudioRecord::InitRecording( | 45 int AudioRecordJni::JavaAudioRecord::InitRecording( |
47 int sample_rate, int channels) { | 46 int sample_rate, int channels) { |
48 return audio_record_->CallIntMethod(init_recording_, | 47 return audio_record_->CallIntMethod(init_recording_, |
49 static_cast<jint>(sample_rate), | 48 static_cast<jint>(sample_rate), |
50 static_cast<jint>(channels)); | 49 static_cast<jint>(channels)); |
51 } | 50 } |
52 | 51 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // of |playDelayMs| and |recDelayMs|, hence the distributions does not matter. | 253 // of |playDelayMs| and |recDelayMs|, hence the distributions does not matter. |
255 audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_, | 254 audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_, |
256 0, // recDelayMs | 255 0, // recDelayMs |
257 0); // clockDrift | 256 0); // clockDrift |
258 if (audio_device_buffer_->DeliverRecordedData() == -1) { | 257 if (audio_device_buffer_->DeliverRecordedData() == -1) { |
259 ALOGE("AudioDeviceBuffer::DeliverRecordedData failed!"); | 258 ALOGE("AudioDeviceBuffer::DeliverRecordedData failed!"); |
260 } | 259 } |
261 } | 260 } |
262 | 261 |
263 } // namespace webrtc | 262 } // namespace webrtc |
OLD | NEW |