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

Side by Side Diff: webrtc/sdk/android/api/org/webrtc/RtpReceiver.java

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 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 public String id() { 45 public String id() {
46 return nativeId(nativeRtpReceiver); 46 return nativeId(nativeRtpReceiver);
47 } 47 }
48 48
49 public void dispose() { 49 public void dispose() {
50 cachedTrack.dispose(); 50 cachedTrack.dispose();
51 if (nativeObserver != 0) { 51 if (nativeObserver != 0) {
52 nativeUnsetObserver(nativeRtpReceiver, nativeObserver); 52 nativeUnsetObserver(nativeRtpReceiver, nativeObserver);
53 nativeObserver = 0; 53 nativeObserver = 0;
54 } 54 }
55 free(nativeRtpReceiver); 55 JniCommon.nativeReleaseRef(nativeRtpReceiver);
56 } 56 }
57 57
58 public void SetObserver(Observer observer) { 58 public void SetObserver(Observer observer) {
59 // Unset the existing one before setting a new one. 59 // Unset the existing one before setting a new one.
60 if (nativeObserver != 0) { 60 if (nativeObserver != 0) {
61 nativeUnsetObserver(nativeRtpReceiver, nativeObserver); 61 nativeUnsetObserver(nativeRtpReceiver, nativeObserver);
62 } 62 }
63 nativeObserver = nativeSetObserver(nativeRtpReceiver, observer); 63 nativeObserver = nativeSetObserver(nativeRtpReceiver, observer);
64 } 64 }
65 65
66 // This should increment the reference count of the track. 66 // This should increment the reference count of the track.
67 // Will be released in dispose(). 67 // Will be released in dispose().
68 private static native long nativeGetTrack(long nativeRtpReceiver); 68 private static native long nativeGetTrack(long nativeRtpReceiver);
69 69
70 private static native boolean nativeSetParameters( 70 private static native boolean nativeSetParameters(
71 long nativeRtpReceiver, RtpParameters parameters); 71 long nativeRtpReceiver, RtpParameters parameters);
72 72
73 private static native RtpParameters nativeGetParameters(long nativeRtpReceiver ); 73 private static native RtpParameters nativeGetParameters(long nativeRtpReceiver );
74 74
75 private static native String nativeId(long nativeRtpReceiver); 75 private static native String nativeId(long nativeRtpReceiver);
76 76
77 private static native void free(long nativeRtpReceiver);
78
79 private static native long nativeSetObserver(long nativeRtpReceiver, Observer observer); 77 private static native long nativeSetObserver(long nativeRtpReceiver, Observer observer);
80 78
81 private static native long nativeUnsetObserver(long nativeRtpReceiver, long na tiveObserver); 79 private static native long nativeUnsetObserver(long nativeRtpReceiver, long na tiveObserver);
82 }; 80 };
OLDNEW
« no previous file with comments | « webrtc/sdk/android/api/org/webrtc/PeerConnection.java ('k') | webrtc/sdk/android/api/org/webrtc/RtpSender.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698