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

Side by Side Diff: webrtc/sdk/android/src/jni/pc/peerconnection_jni.cc

Issue 3003213002: Android: Add common function for adding/releasing native reference (Closed)
Patch Set: Rebase Created 3 years, 3 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 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 JNIEnv* jni, 51 JNIEnv* jni,
52 jobject j_pc) { 52 jobject j_pc) {
53 jfieldID native_pc_id = 53 jfieldID native_pc_id =
54 GetFieldID(jni, GetObjectClass(jni, j_pc), "nativePeerConnection", "J"); 54 GetFieldID(jni, GetObjectClass(jni, j_pc), "nativePeerConnection", "J");
55 jlong j_p = GetLongField(jni, j_pc, native_pc_id); 55 jlong j_p = GetLongField(jni, j_pc, native_pc_id);
56 return rtc::scoped_refptr<webrtc::PeerConnectionInterface>( 56 return rtc::scoped_refptr<webrtc::PeerConnectionInterface>(
57 reinterpret_cast<webrtc::PeerConnectionInterface*>(j_p)); 57 reinterpret_cast<webrtc::PeerConnectionInterface*>(j_p));
58 } 58 }
59 59
60 JNI_FUNCTION_DECLARATION(void, 60 JNI_FUNCTION_DECLARATION(void,
61 PeerConnection_freePeerConnection,
62 JNIEnv*,
63 jclass,
64 jlong j_p) {
65 reinterpret_cast<webrtc::PeerConnectionInterface*>(j_p)->Release();
66 }
67
68 JNI_FUNCTION_DECLARATION(void,
69 PeerConnection_freeObserver, 61 PeerConnection_freeObserver,
70 JNIEnv*, 62 JNIEnv*,
71 jclass, 63 jclass,
72 jlong j_p) { 64 jlong j_p) {
73 PeerConnectionObserverJni* p = 65 PeerConnectionObserverJni* p =
74 reinterpret_cast<PeerConnectionObserverJni*>(j_p); 66 reinterpret_cast<PeerConnectionObserverJni*>(j_p);
75 delete p; 67 delete p;
76 } 68 }
77 69
78 JNI_FUNCTION_DECLARATION(jobject, 70 JNI_FUNCTION_DECLARATION(jobject,
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 417
426 JNI_FUNCTION_DECLARATION(void, 418 JNI_FUNCTION_DECLARATION(void,
427 PeerConnection_close, 419 PeerConnection_close,
428 JNIEnv* jni, 420 JNIEnv* jni,
429 jobject j_pc) { 421 jobject j_pc) {
430 ExtractNativePC(jni, j_pc)->Close(); 422 ExtractNativePC(jni, j_pc)->Close();
431 return; 423 return;
432 } 424 }
433 425
434 } // namespace webrtc_jni 426 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/sdk/android/src/jni/pc/mediastreamtrack_jni.cc ('k') | webrtc/sdk/android/src/jni/pc/rtpreceiver_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698