Chromium Code Reviews| 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 65% |
| copy from talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java |
| copy to talk/app/webrtc/java/src/org/webrtc/RtpReceiver.java |
| index f7032a739bdbb24ac93dc000b9a42fb11223cc40..178116b617c3eb41004b2b05a86db2904e2c824b 100644 |
| --- a/talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java |
| +++ b/talk/app/webrtc/java/src/org/webrtc/RtpReceiver.java |
| @@ -27,31 +27,36 @@ |
| 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 = nativeTrack(nativeRtpReceiver); |
| + cachedTrack = new MediaStreamTrack(track); |
|
AlexG
2015/10/02 22:44:35
Why is this logic different from RtpSender? cached
Taylor Brandstetter
2015/10/03 01:50:10
It will be possible in the near future to have an
|
| + } |
| - 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(). |
|
AlexG
2015/10/02 22:44:36
I think it actually decrements refcount - it calls
Taylor Brandstetter
2015/10/03 01:50:10
scoped_refptr::release actually means that the poi
|
| + private static native long nativeTrack(long nativeRtpReceiver); |
| + |
| + private static native String nativeId(long nativeRtpReceiver); |
| + |
| + private static native void free(long nativeRtpReceiver); |
| +}; |