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

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: 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 JOW(jstring, RtpReceiver_nativeId) 45 JOW(jstring, RtpReceiver_nativeId)
46 (JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { 46 (JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) {
47 return JavaStringFromStdString( 47 return JavaStringFromStdString(
48 jni, 48 jni,
49 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer) 49 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer)
50 ->id()); 50 ->id());
51 } 51 }
52 52
53 JOW(void, RtpReceiver_free)
54 (JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) {
55 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer)
56 ->Release();
57 }
58
59 JOW(jlong, RtpReceiver_nativeSetObserver) 53 JOW(jlong, RtpReceiver_nativeSetObserver)
60 (JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer, jobject j_observer) { 54 (JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer, jobject j_observer) {
61 RtpReceiverObserverJni* rtpReceiverObserver = 55 RtpReceiverObserverJni* rtpReceiverObserver =
62 new RtpReceiverObserverJni(jni, j_observer); 56 new RtpReceiverObserverJni(jni, j_observer);
63 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer) 57 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer)
64 ->SetObserver(rtpReceiverObserver); 58 ->SetObserver(rtpReceiverObserver);
65 return jlongFromPointer(rtpReceiverObserver); 59 return jlongFromPointer(rtpReceiverObserver);
66 } 60 }
67 61
68 JOW(void, RtpReceiver_nativeUnsetObserver) 62 JOW(void, RtpReceiver_nativeUnsetObserver)
69 (JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer, jlong j_observer_pointer) { 63 (JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer, jlong j_observer_pointer) {
70 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer) 64 reinterpret_cast<webrtc::RtpReceiverInterface*>(j_rtp_receiver_pointer)
71 ->SetObserver(nullptr); 65 ->SetObserver(nullptr);
72 RtpReceiverObserverJni* observer = 66 RtpReceiverObserverJni* observer =
73 reinterpret_cast<RtpReceiverObserverJni*>(j_observer_pointer); 67 reinterpret_cast<RtpReceiverObserverJni*>(j_observer_pointer);
74 if (observer) { 68 if (observer) {
75 delete observer; 69 delete observer;
76 } 70 }
77 } 71 }
78 72
79 } // namespace webrtc_jni 73 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698