Chromium Code Reviews

Unified Diff: talk/app/webrtc/java/src/org/webrtc/RtpReceiver.java

Issue 1368143002: Java binding for RtpSender/RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Getting rid of obsolete methods, and using unmodifiableList. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: talk/app/webrtc/java/src/org/webrtc/RtpReceiver.java
diff --git a/talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java b/talk/app/webrtc/java/src/org/webrtc/RtpReceiver.java
similarity index 63%
copy from talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java
copy to talk/app/webrtc/java/src/org/webrtc/RtpReceiver.java
index f7032a739bdbb24ac93dc000b9a42fb11223cc40..597f4413342e70877d969338b2dd418a3beec0bb 100644
--- a/talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java
+++ b/talk/app/webrtc/java/src/org/webrtc/RtpReceiver.java
@@ -27,31 +27,37 @@
package org.webrtc;
-public class CallSessionFileRotatingLogSink {
- static {
- System.loadLibrary("jingle_peerconnection_so");
- }
+/** Java wrapper for a C++ RtpReceiverInterface. */
+public class RtpReceiver {
+ final long nativeRtpReceiver;
+
+ private MediaStreamTrack cachedTrack;
- private long nativeSink;
+ public RtpReceiver(long nativeRtpReceiver) {
+ this.nativeRtpReceiver = nativeRtpReceiver;
+ long track = nativeGetTrack(nativeRtpReceiver);
+ // We can assume that an RtpReceiver always has an associated track.
+ cachedTrack = new MediaStreamTrack(track);
+ }
- public static byte[] getLogData(String dirPath) {
- return nativeGetLogData(dirPath);
+ public MediaStreamTrack track() {
+ return cachedTrack;
}
- public CallSessionFileRotatingLogSink(
- String dirPath, int maxFileSize, Logging.Severity severity) {
- nativeSink = nativeAddSink(dirPath, maxFileSize, severity.ordinal());
+ public String id() {
+ return nativeId(nativeRtpReceiver);
}
public void dispose() {
- if (nativeSink != 0) {
- nativeDeleteSink(nativeSink);
- nativeSink = 0;
- }
+ cachedTrack.dispose();
+ free(nativeRtpReceiver);
}
- private static native long nativeAddSink(
- String dirPath, int maxFileSize, int severity);
- private static native void nativeDeleteSink(long nativeSink);
- private static native byte[] nativeGetLogData(String dirPath);
-}
+ // This should increment the reference count of the track.
+ // Will be released in dispose().
+ private static native long nativeGetTrack(long nativeRtpReceiver);
+
+ private static native String nativeId(long nativeRtpReceiver);
+
+ private static native void free(long nativeRtpReceiver);
+};
« no previous file with comments | « talk/app/webrtc/java/src/org/webrtc/PeerConnection.java ('k') | talk/app/webrtc/java/src/org/webrtc/RtpSender.java » ('j') | no next file with comments »

Powered by Google App Engine