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 |
11 package org.webrtc; | 11 package org.webrtc; |
12 | 12 |
13 /** Java wrapper for a C++ RtpReceiverInterface. */ | 13 /** Java wrapper for a C++ RtpReceiverInterface. */ |
14 public class RtpReceiver { | 14 public class RtpReceiver { |
15 final long nativeRtpReceiver; | 15 final long nativeRtpReceiver; |
16 | 16 |
17 private MediaStreamTrack cachedTrack; | 17 private MediaStreamTrack cachedTrack; |
18 | 18 |
19 public RtpReceiver(long nativeRtpReceiver) { | 19 public RtpReceiver(long nativeRtpReceiver) { |
20 this.nativeRtpReceiver = nativeRtpReceiver; | 20 this.nativeRtpReceiver = nativeRtpReceiver; |
21 long track = nativeGetTrack(nativeRtpReceiver); | 21 long track = nativeGetTrack(nativeRtpReceiver); |
22 // We can assume that an RtpReceiver always has an associated track. | 22 // We can assume that an RtpReceiver always has an associated track. |
23 cachedTrack = new MediaStreamTrack(track); | 23 cachedTrack = new MediaStreamTrack(track); |
24 } | 24 } |
25 | 25 |
26 public MediaStreamTrack track() { | 26 public MediaStreamTrack track() { |
27 return cachedTrack; | 27 return cachedTrack; |
28 } | 28 } |
29 | 29 |
| 30 public boolean setParameters(RtpParameters parameters) { |
| 31 return nativeSetParameters(nativeRtpReceiver, parameters); |
| 32 } |
| 33 |
| 34 public RtpParameters getParameters() { |
| 35 return nativeGetParameters(nativeRtpReceiver); |
| 36 } |
| 37 |
30 public String id() { | 38 public String id() { |
31 return nativeId(nativeRtpReceiver); | 39 return nativeId(nativeRtpReceiver); |
32 } | 40 } |
33 | 41 |
34 public void dispose() { | 42 public void dispose() { |
35 cachedTrack.dispose(); | 43 cachedTrack.dispose(); |
36 free(nativeRtpReceiver); | 44 free(nativeRtpReceiver); |
37 } | 45 } |
38 | 46 |
39 // This should increment the reference count of the track. | 47 // This should increment the reference count of the track. |
40 // Will be released in dispose(). | 48 // Will be released in dispose(). |
41 private static native long nativeGetTrack(long nativeRtpReceiver); | 49 private static native long nativeGetTrack(long nativeRtpReceiver); |
42 | 50 |
| 51 private static native boolean nativeSetParameters(long nativeRtpReceiver, |
| 52 RtpParameters parameters); |
| 53 |
| 54 private static native RtpParameters nativeGetParameters(long nativeRtpReceiver
); |
| 55 |
43 private static native String nativeId(long nativeRtpReceiver); | 56 private static native String nativeId(long nativeRtpReceiver); |
44 | 57 |
45 private static native void free(long nativeRtpReceiver); | 58 private static native void free(long nativeRtpReceiver); |
46 }; | 59 }; |
OLD | NEW |