Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: webrtc/sdk/android/api/org/webrtc/PeerConnectionFactoryBase.java

Issue 2767643002: Enable the Java wrapper to load different .so library.
Patch Set: Add static method to the subclass to solve the linking error. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/sdk/android/api/org/webrtc/PeerConnectionFactoryBase.java
diff --git a/webrtc/sdk/android/api/org/webrtc/PeerConnectionFactory.java b/webrtc/sdk/android/api/org/webrtc/PeerConnectionFactoryBase.java
similarity index 78%
copy from webrtc/sdk/android/api/org/webrtc/PeerConnectionFactory.java
copy to webrtc/sdk/android/api/org/webrtc/PeerConnectionFactoryBase.java
index 28b3ca72ab9b98e4f74db5d2a7f80bf3955cfc18..a70e283d2a78c30f33ed485cdb1f95598ae63a63 100644
--- a/webrtc/sdk/android/api/org/webrtc/PeerConnectionFactory.java
+++ b/webrtc/sdk/android/api/org/webrtc/PeerConnectionFactoryBase.java
@@ -13,28 +13,19 @@ package org.webrtc;
import java.util.List;
/**
- * Java wrapper for a C++ PeerConnectionFactoryInterface. Main entry point to
- * the PeerConnection API for clients.
+ * Java wrapper for a C++ PeerConnectionFactoryInterface. The base class of a PeerConnectionFactory
+ * without loading any library.
*/
-public class PeerConnectionFactory {
- private static volatile boolean nativeLibLoaded;
-
- static {
- try {
- System.loadLibrary("jingle_peerconnection_so");
- nativeLibLoaded = true;
- } catch (UnsatisfiedLinkError t) {
- nativeLibLoaded = false;
- }
- }
+public class PeerConnectionFactoryBase {
+ protected static volatile boolean nativeLibLoaded;
- private static final String TAG = "PeerConnectionFactory";
- private final long nativeFactory;
- private static Thread networkThread;
- private static Thread workerThread;
- private static Thread signalingThread;
- private EglBase localEglbase;
- private EglBase remoteEglbase;
+ protected static final String TAG = "PeerConnectionFactoryBase";
+ protected final long nativeFactory;
+ protected static Thread networkThread;
+ protected static Thread workerThread;
+ protected static Thread signalingThread;
+ protected EglBase localEglbase;
+ protected EglBase remoteEglbase;
public static class Options {
// Keep in sync with webrtc/base/network.h!
@@ -50,51 +41,35 @@ public class PeerConnectionFactory {
public boolean disableNetworkMonitor;
}
- // Must be called at least once before creating a PeerConnectionFactory
- // (for example, at application startup time).
- public static native void initializeAndroidGlobals(
+ protected static native void initializeAndroidGlobals(
android.content.Context context, boolean videoHwAcceleration);
// Older signature of initializeAndroidGlobals. The extra parameters are now meaningless.
@Deprecated
- public static boolean initializeAndroidGlobals(Object context, boolean initializeAudio,
+ protected static boolean initializeAndroidGlobals(Object context, boolean initializeAudio,
boolean initializeVideo, boolean videoHwAcceleration) {
initializeAndroidGlobals((android.content.Context) context, videoHwAcceleration);
return true;
}
- // Field trial initialization. Must be called before PeerConnectionFactory
- // is created.
- public static native void initializeFieldTrials(String fieldTrialsInitString);
- // Wrapper of webrtc::field_trial::FindFullName. Develop the feature with default behaviour off.
- // Example usage:
- // if (PeerConnectionFactory.fieldTrialsFindFullName("WebRTCExperiment").equals("Enabled")) {
- // method1();
- // } else {
- // method2();
- // }
+ protected static native void initializeFieldTrials(String fieldTrialsInitString);
public static String fieldTrialsFindFullName(String name) {
return nativeLibLoaded ? nativeFieldTrialsFindFullName(name) : "";
}
private static native String nativeFieldTrialsFindFullName(String name);
- // Internal tracing initialization. Must be called before PeerConnectionFactory is created to
- // prevent racing with tracing code.
- public static native void initializeInternalTracer();
- // Internal tracing shutdown, called to prevent resource leaks. Must be called after
- // PeerConnectionFactory is gone to prevent races with code performing tracing.
- public static native void shutdownInternalTracer();
- // Start/stop internal capturing of internal tracing.
- public static native boolean startInternalTracingCapture(String tracing_filename);
- public static native void stopInternalTracingCapture();
+ protected static native void initializeInternalTracer();
+ protected static native void shutdownInternalTracer();
+ protected static native boolean startInternalTracingCapture(String tracing_filename);
+ protected static native void stopInternalTracingCapture();
@Deprecated
- public PeerConnectionFactory() {
+ public PeerConnectionFactoryBase() {
this(null);
}
// Note: initializeAndroidGlobals must be called at least once before
// constructing a PeerConnectionFactory.
- public PeerConnectionFactory(Options options) {
+ public PeerConnectionFactoryBase(Options options) {
nativeFactory = nativeCreatePeerConnectionFactory(options);
if (nativeFactory == 0) {
throw new RuntimeException("Failed to initialize PeerConnectionFactory!");
@@ -204,7 +179,7 @@ public class PeerConnectionFactory {
nativeThreadsCallbacks(nativeFactory);
}
- private static void printStackTrace(Thread thread, String threadName) {
+ protected static void printStackTrace(Thread thread, String threadName) {
if (thread != null) {
StackTraceElement[] stackTraces = thread.getStackTrace();
if (stackTraces.length > 0) {
@@ -222,17 +197,17 @@ public class PeerConnectionFactory {
printStackTrace(signalingThread, "Signaling thread");
}
- private static void onNetworkThreadReady() {
+ protected static void onNetworkThreadReady() {
networkThread = Thread.currentThread();
Logging.d(TAG, "onNetworkThreadReady");
}
- private static void onWorkerThreadReady() {
+ protected static void onWorkerThreadReady() {
workerThread = Thread.currentThread();
Logging.d(TAG, "onWorkerThreadReady");
}
- private static void onSignalingThreadReady() {
+ protected static void onSignalingThreadReady() {
signalingThread = Thread.currentThread();
Logging.d(TAG, "onSignalingThreadReady");
}

Powered by Google App Engine
This is Rietveld 408576698