OLD | NEW |
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 Loading... |
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 }; |
OLD | NEW |