Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: webrtc/modules/audio_device/android/audio_record_jni.cc

Issue 2894593002: Revert of Removes usage of native base::android::GetApplicationContext() (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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( 93 j_audio_record_.reset(new JavaAudioRecord(
94 new JavaAudioRecord(j_native_registration_.get(), 94 j_native_registration_.get(),
95 j_native_registration_->NewObject( 95 j_native_registration_->NewObject(
96 "<init>", "(J)V", PointerTojlong(this)))); 96 "<init>", "(Landroid/content/Context;J)V",
97 JVM::GetInstance()->context(), PointerTojlong(this))));
97 // Detach from this thread since we want to use the checker to verify calls 98 // Detach from this thread since we want to use the checker to verify calls
98 // from the Java based audio thread. 99 // from the Java based audio thread.
99 thread_checker_java_.DetachFromThread(); 100 thread_checker_java_.DetachFromThread();
100 } 101 }
101 102
102 AudioRecordJni::~AudioRecordJni() { 103 AudioRecordJni::~AudioRecordJni() {
103 ALOGD("~dtor%s", GetThreadInfo().c_str()); 104 ALOGD("~dtor%s", GetThreadInfo().c_str());
104 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 105 RTC_DCHECK(thread_checker_.CalledOnValidThread());
105 Terminate(); 106 Terminate();
106 } 107 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // of |playDelayMs| and |recDelayMs|, hence the distributions does not matter. 248 // of |playDelayMs| and |recDelayMs|, hence the distributions does not matter.
248 audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_, 249 audio_device_buffer_->SetVQEData(total_delay_in_milliseconds_,
249 0, // recDelayMs 250 0, // recDelayMs
250 0); // clockDrift 251 0); // clockDrift
251 if (audio_device_buffer_->DeliverRecordedData() == -1) { 252 if (audio_device_buffer_->DeliverRecordedData() == -1) {
252 ALOGE("AudioDeviceBuffer::DeliverRecordedData failed!"); 253 ALOGE("AudioDeviceBuffer::DeliverRecordedData failed!");
253 } 254 }
254 } 255 }
255 256
256 } // namespace webrtc 257 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/android/audio_manager.cc ('k') | webrtc/modules/audio_device/android/audio_track_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698