| 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 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 RTC_CHECK(j_environment_); | 83 RTC_CHECK(j_environment_); |
| 84 JNINativeMethod native_methods[] = { | 84 JNINativeMethod native_methods[] = { |
| 85 {"nativeCacheDirectBufferAddress", "(Ljava/nio/ByteBuffer;J)V", | 85 {"nativeCacheDirectBufferAddress", "(Ljava/nio/ByteBuffer;J)V", |
| 86 reinterpret_cast<void*>( | 86 reinterpret_cast<void*>( |
| 87 &webrtc::AudioRecordJni::CacheDirectBufferAddress)}, | 87 &webrtc::AudioRecordJni::CacheDirectBufferAddress)}, |
| 88 {"nativeDataIsRecorded", "(IJ)V", | 88 {"nativeDataIsRecorded", "(IJ)V", |
| 89 reinterpret_cast<void*>(&webrtc::AudioRecordJni::DataIsRecorded)}}; | 89 reinterpret_cast<void*>(&webrtc::AudioRecordJni::DataIsRecorded)}}; |
| 90 j_native_registration_ = j_environment_->RegisterNatives( | 90 j_native_registration_ = j_environment_->RegisterNatives( |
| 91 "org/webrtc/voiceengine/WebRtcAudioRecord", native_methods, | 91 "org/webrtc/voiceengine/WebRtcAudioRecord", native_methods, |
| 92 arraysize(native_methods)); | 92 arraysize(native_methods)); |
| 93 j_audio_record_.reset(new JavaAudioRecord( | 93 j_audio_record_.reset( |
| 94 j_native_registration_.get(), | 94 new JavaAudioRecord(j_native_registration_.get(), |
| 95 j_native_registration_->NewObject( | 95 j_native_registration_->NewObject( |
| 96 "<init>", "(Landroid/content/Context;J)V", | 96 "<init>", "(J)V", PointerTojlong(this)))); |
| 97 JVM::GetInstance()->context(), PointerTojlong(this)))); | |
| 98 // Detach from this thread since we want to use the checker to verify calls | 97 // Detach from this thread since we want to use the checker to verify calls |
| 99 // from the Java based audio thread. | 98 // from the Java based audio thread. |
| 100 thread_checker_java_.DetachFromThread(); | 99 thread_checker_java_.DetachFromThread(); |
| 101 } | 100 } |
| 102 | 101 |
| 103 AudioRecordJni::~AudioRecordJni() { | 102 AudioRecordJni::~AudioRecordJni() { |
| 104 ALOGD("~dtor%s", GetThreadInfo().c_str()); | 103 ALOGD("~dtor%s", GetThreadInfo().c_str()); |
| 105 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 104 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 106 Terminate(); | 105 Terminate(); |
| 107 } | 106 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // of |playDelayMs| and |recDelayMs|, hence the distributions does not matter. | 247 // of |playDelayMs| and |recDelayMs|, hence the distributions does not matter. |
| 249 audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_, | 248 audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_, |
| 250 0, // recDelayMs | 249 0, // recDelayMs |
| 251 0); // clockDrift | 250 0); // clockDrift |
| 252 if (audio_device_buffer_->DeliverRecordedData() == -1) { | 251 if (audio_device_buffer_->DeliverRecordedData() == -1) { |
| 253 ALOGE("AudioDeviceBuffer::DeliverRecordedData failed!"); | 252 ALOGE("AudioDeviceBuffer::DeliverRecordedData failed!"); |
| 254 } | 253 } |
| 255 } | 254 } |
| 256 | 255 |
| 257 } // namespace webrtc | 256 } // namespace webrtc |
| OLD | NEW |