Index: talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java |
diff --git a/talk/app/webrtc/java/src/org/webrtc/MediaSource.java b/talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java |
similarity index 66% |
copy from talk/app/webrtc/java/src/org/webrtc/MediaSource.java |
copy to talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java |
index d79b4628eb79506a69f59ea14651850d6979b20c..f7032a739bdbb24ac93dc000b9a42fb11223cc40 100644 |
--- a/talk/app/webrtc/java/src/org/webrtc/MediaSource.java |
+++ b/talk/app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java |
@@ -1,6 +1,6 @@ |
/* |
* libjingle |
- * Copyright 2013 Google Inc. |
+ * Copyright 2015 Google Inc. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are met: |
@@ -25,31 +25,33 @@ |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
- |
package org.webrtc; |
-/** Java wrapper for a C++ MediaSourceInterface. */ |
-public class MediaSource { |
- /** Tracks MediaSourceInterface.SourceState */ |
- public enum State { |
- INITIALIZING, LIVE, ENDED, MUTED |
+public class CallSessionFileRotatingLogSink { |
+ static { |
+ System.loadLibrary("jingle_peerconnection_so"); |
} |
- final long nativeSource; // Package-protected for PeerConnectionFactory. |
+ private long nativeSink; |
- public MediaSource(long nativeSource) { |
- this.nativeSource = nativeSource; |
+ public static byte[] getLogData(String dirPath) { |
+ return nativeGetLogData(dirPath); |
} |
- public State state() { |
- return nativeState(nativeSource); |
+ public CallSessionFileRotatingLogSink( |
+ String dirPath, int maxFileSize, Logging.Severity severity) { |
+ nativeSink = nativeAddSink(dirPath, maxFileSize, severity.ordinal()); |
} |
public void dispose() { |
- free(nativeSource); |
+ if (nativeSink != 0) { |
+ nativeDeleteSink(nativeSink); |
+ nativeSink = 0; |
+ } |
} |
- private static native State nativeState(long pointer); |
- |
- private static native void free(long nativeSource); |
+ 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); |
} |