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

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

Issue 2897423002: Revert of https://codereview.webrtc.org/2889183002/ (Closed)
Patch Set: new 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 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( 92 j_audio_track_.reset(new JavaAudioTrack(
93 new JavaAudioTrack(j_native_registration_.get(), 93 j_native_registration_.get(),
94 j_native_registration_->NewObject( 94 j_native_registration_->NewObject(
95 "<init>", "(J)V", PointerTojlong(this)))); 95 "<init>", "(Landroid/content/Context;J)V",
96 JVM::GetInstance()->context(), PointerTojlong(this))));
96 // 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
97 // from the Java based audio thread. 98 // from the Java based audio thread.
98 thread_checker_java_.DetachFromThread(); 99 thread_checker_java_.DetachFromThread();
99 } 100 }
100 101
101 AudioTrackJni::~AudioTrackJni() { 102 AudioTrackJni::~AudioTrackJni() {
102 ALOGD("~dtor%s", GetThreadInfo().c_str()); 103 ALOGD("~dtor%s", GetThreadInfo().c_str());
103 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 104 RTC_DCHECK(thread_checker_.CalledOnValidThread());
104 Terminate(); 105 Terminate();
105 } 106 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return; 256 return;
256 } 257 }
257 RTC_DCHECK_EQ(samples, frames_per_buffer_); 258 RTC_DCHECK_EQ(samples, frames_per_buffer_);
258 // Copy decoded data into common byte buffer to ensure that it can be 259 // Copy decoded data into common byte buffer to ensure that it can be
259 // written to the Java based audio track. 260 // written to the Java based audio track.
260 samples = audio_device_buffer_->GetPlayoutData(direct_buffer_address_); 261 samples = audio_device_buffer_->GetPlayoutData(direct_buffer_address_);
261 RTC_DCHECK_EQ(length, bytes_per_frame * samples); 262 RTC_DCHECK_EQ(length, bytes_per_frame * samples);
262 } 263 }
263 264
264 } // namespace webrtc 265 } // 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