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

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

Issue 2903253004: Reland of Removes usage of native base::android::GetApplicationContext() (Closed)
Patch Set: Deprecated comment. Created 3 years, 6 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 RTC_CHECK(j_environment_); 82 RTC_CHECK(j_environment_);
83 JNINativeMethod native_methods[] = { 83 JNINativeMethod native_methods[] = {
84 {"nativeCacheDirectBufferAddress", "(Ljava/nio/ByteBuffer;J)V", 84 {"nativeCacheDirectBufferAddress", "(Ljava/nio/ByteBuffer;J)V",
85 reinterpret_cast<void*>( 85 reinterpret_cast<void*>(
86 &webrtc::AudioTrackJni::CacheDirectBufferAddress)}, 86 &webrtc::AudioTrackJni::CacheDirectBufferAddress)},
87 {"nativeGetPlayoutData", "(IJ)V", 87 {"nativeGetPlayoutData", "(IJ)V",
88 reinterpret_cast<void*>(&webrtc::AudioTrackJni::GetPlayoutData)}}; 88 reinterpret_cast<void*>(&webrtc::AudioTrackJni::GetPlayoutData)}};
89 j_native_registration_ = j_environment_->RegisterNatives( 89 j_native_registration_ = j_environment_->RegisterNatives(
90 "org/webrtc/voiceengine/WebRtcAudioTrack", native_methods, 90 "org/webrtc/voiceengine/WebRtcAudioTrack", native_methods,
91 arraysize(native_methods)); 91 arraysize(native_methods));
92 j_audio_track_.reset(new JavaAudioTrack( 92 j_audio_track_.reset(
93 j_native_registration_.get(), 93 new JavaAudioTrack(j_native_registration_.get(),
94 j_native_registration_->NewObject( 94 j_native_registration_->NewObject(
95 "<init>", "(Landroid/content/Context;J)V", 95 "<init>", "(J)V", PointerTojlong(this))));
96 JVM::GetInstance()->context(), PointerTojlong(this))));
97 // Detach from this thread since we want to use the checker to verify calls 96 // Detach from this thread since we want to use the checker to verify calls
98 // from the Java based audio thread. 97 // from the Java based audio thread.
99 thread_checker_java_.DetachFromThread(); 98 thread_checker_java_.DetachFromThread();
100 } 99 }
101 100
102 AudioTrackJni::~AudioTrackJni() { 101 AudioTrackJni::~AudioTrackJni() {
103 ALOGD("~dtor%s", GetThreadInfo().c_str()); 102 ALOGD("~dtor%s", GetThreadInfo().c_str());
104 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 103 RTC_DCHECK(thread_checker_.CalledOnValidThread());
105 Terminate(); 104 Terminate();
106 } 105 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return; 255 return;
257 } 256 }
258 RTC_DCHECK_EQ(samples, frames_per_buffer_); 257 RTC_DCHECK_EQ(samples, frames_per_buffer_);
259 // Copy decoded data into common byte buffer to ensure that it can be 258 // Copy decoded data into common byte buffer to ensure that it can be
260 // written to the Java based audio track. 259 // written to the Java based audio track.
261 samples = audio_device_buffer_->GetPlayoutData(direct_buffer_address_); 260 samples = audio_device_buffer_->GetPlayoutData(direct_buffer_address_);
262 RTC_DCHECK_EQ(length, bytes_per_frame * samples); 261 RTC_DCHECK_EQ(length, bytes_per_frame * samples);
263 } 262 }
264 263
265 } // namespace webrtc 264 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/android/audio_record_jni.cc ('k') | webrtc/modules/audio_device/android/ensure_initialized.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698