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

Side by Side Diff: webrtc/sdk/android/src/jni/pc/rtpreceiver_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 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 RtpReceiver_nativeId, 57 RtpReceiver_nativeId,
58 JNIEnv* jni, 58 JNIEnv* jni,
59 jclass, 59 jclass,
60 jlong j_rtp_receiver_pointer) { 60 jlong j_rtp_receiver_pointer) {
61 return JavaStringFromStdString( 61 return JavaStringFromStdString(
62 jni, 62 jni,
63 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer) 63 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer)
64 ->id()); 64 ->id());
65 } 65 }
66 66
67 JNI_FUNCTION_DECLARATION(void,
68 RtpReceiver_free,
69 JNIEnv* jni,
70 jclass,
71 jlong j_rtp_receiver_pointer) {
72 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer)
73 ->Release();
74 }
75
76 JNI_FUNCTION_DECLARATION(jlong, 67 JNI_FUNCTION_DECLARATION(jlong,
77 RtpReceiver_nativeSetObserver, 68 RtpReceiver_nativeSetObserver,
78 JNIEnv* jni, 69 JNIEnv* jni,
79 jclass, 70 jclass,
80 jlong j_rtp_receiver_pointer, 71 jlong j_rtp_receiver_pointer,
81 jobject j_observer) { 72 jobject j_observer) {
82 RtpReceiverObserverJni* rtpReceiverObserver = 73 RtpReceiverObserverJni* rtpReceiverObserver =
83 new RtpReceiverObserverJni(jni, j_observer); 74 new RtpReceiverObserverJni(jni, j_observer);
84 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer) 75 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer)
85 ->SetObserver(rtpReceiverObserver); 76 ->SetObserver(rtpReceiverObserver);
86 return jlongFromPointer(rtpReceiverObserver); 77 return jlongFromPointer(rtpReceiverObserver);
87 } 78 }
88 79
89 JNI_FUNCTION_DECLARATION(void, 80 JNI_FUNCTION_DECLARATION(void,
90 RtpReceiver_nativeUnsetObserver, 81 RtpReceiver_nativeUnsetObserver,
91 JNIEnv* jni, 82 JNIEnv* jni,
92 jclass, 83 jclass,
93 jlong j_rtp_receiver_pointer, 84 jlong j_rtp_receiver_pointer,
94 jlong j_observer_pointer) { 85 jlong j_observer_pointer) {
95 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer) 86 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer)
96 ->SetObserver(nullptr); 87 ->SetObserver(nullptr);
97 RtpReceiverObserverJni* observer = 88 RtpReceiverObserverJni* observer =
98 reinterpret_cast<RtpReceiverObserverJni*>(j_observer_pointer); 89 reinterpret_cast<RtpReceiverObserverJni*>(j_observer_pointer);
99 if (observer) { 90 if (observer) {
100 delete observer; 91 delete observer;
101 } 92 }
102 } 93 }
103 94
104 } // namespace webrtc_jni 95 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/sdk/android/src/jni/pc/peerconnection_jni.cc ('k') | webrtc/sdk/android/src/jni/pc/rtpsender_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698