Remove static library loading from WebRTC Android SDK.
Bug: webrtc:7474 Change-Id: Ie75a5c12638be82d7bd91073744946ac21c48155 Reviewed-on: https://webrtc-review.googlesource.com/22962 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20865}
This commit is contained in:
parent
ff610bd2b2
commit
3e189a6dc3
@ -69,18 +69,6 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
||||
CallFragment.OnCallEvents {
|
||||
private static final String TAG = "CallRTCClient";
|
||||
|
||||
// Fix for devices running old Android versions not finding the libraries.
|
||||
// https://bugs.chromium.org/p/webrtc/issues/detail?id=6751
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("c++_shared");
|
||||
System.loadLibrary("boringssl.cr");
|
||||
System.loadLibrary("protobuf_lite.cr");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
Logging.w(TAG, "Failed to load native dependencies: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static final String EXTRA_ROOMID = "org.appspot.apprtc.ROOMID";
|
||||
public static final String EXTRA_URLPARAMETERS = "org.appspot.apprtc.URLPARAMETERS";
|
||||
public static final String EXTRA_LOOPBACK = "org.appspot.apprtc.LOOPBACK";
|
||||
|
||||
@ -30,8 +30,6 @@ import java.util.logging.Logger;
|
||||
public class Logging {
|
||||
private static final Logger fallbackLogger = createFallbackLogger();
|
||||
private static volatile boolean loggingEnabled;
|
||||
private static enum NativeLibStatus { UNINITIALIZED, LOADED, FAILED }
|
||||
private static volatile NativeLibStatus nativeLibStatus = NativeLibStatus.UNINITIALIZED;
|
||||
|
||||
private static Logger createFallbackLogger() {
|
||||
final Logger fallbackLogger = Logger.getLogger("org.webrtc.Logging");
|
||||
@ -39,19 +37,6 @@ public class Logging {
|
||||
return fallbackLogger;
|
||||
}
|
||||
|
||||
private static boolean loadNativeLibrary() {
|
||||
if (nativeLibStatus == NativeLibStatus.UNINITIALIZED) {
|
||||
try {
|
||||
System.loadLibrary("jingle_peerconnection_so");
|
||||
nativeLibStatus = NativeLibStatus.LOADED;
|
||||
} catch (UnsatisfiedLinkError t) {
|
||||
nativeLibStatus = NativeLibStatus.FAILED;
|
||||
fallbackLogger.log(Level.WARNING, "Failed to load jingle_peerconnection_so: ", t);
|
||||
}
|
||||
}
|
||||
return nativeLibStatus == NativeLibStatus.LOADED;
|
||||
}
|
||||
|
||||
// TODO(solenberg): Remove once dependent projects updated.
|
||||
@Deprecated
|
||||
public enum TraceLevel {
|
||||
@ -81,19 +66,10 @@ public class Logging {
|
||||
public enum Severity { LS_SENSITIVE, LS_VERBOSE, LS_INFO, LS_WARNING, LS_ERROR, LS_NONE }
|
||||
|
||||
public static void enableLogThreads() {
|
||||
if (!loadNativeLibrary()) {
|
||||
fallbackLogger.log(Level.WARNING, "Cannot enable log thread because native lib not loaded.");
|
||||
return;
|
||||
}
|
||||
nativeEnableLogThreads();
|
||||
}
|
||||
|
||||
public static void enableLogTimeStamps() {
|
||||
if (!loadNativeLibrary()) {
|
||||
fallbackLogger.log(
|
||||
Level.WARNING, "Cannot enable log timestamps because native lib not loaded.");
|
||||
return;
|
||||
}
|
||||
nativeEnableLogTimeStamps();
|
||||
}
|
||||
|
||||
@ -107,10 +83,6 @@ public class Logging {
|
||||
// TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression.
|
||||
@SuppressWarnings("NoSynchronizedMethodCheck")
|
||||
public static synchronized void enableLogToDebugOutput(Severity severity) {
|
||||
if (!loadNativeLibrary()) {
|
||||
fallbackLogger.log(Level.WARNING, "Cannot enable logging because native lib not loaded.");
|
||||
return;
|
||||
}
|
||||
nativeEnableLogToDebugOutput(severity.ordinal());
|
||||
loggingEnabled = true;
|
||||
}
|
||||
|
||||
@ -11,10 +11,6 @@
|
||||
package org.webrtc;
|
||||
|
||||
public class CallSessionFileRotatingLogSink {
|
||||
static {
|
||||
System.loadLibrary("jingle_peerconnection_so");
|
||||
}
|
||||
|
||||
private long nativeSink;
|
||||
|
||||
public static byte[] getLogData(String dirPath) {
|
||||
|
||||
@ -21,10 +21,6 @@ import java.util.TimerTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class FileVideoCapturer implements VideoCapturer {
|
||||
static {
|
||||
System.loadLibrary("jingle_peerconnection_so");
|
||||
}
|
||||
|
||||
private interface VideoReader {
|
||||
VideoFrame getNextFrame();
|
||||
void close();
|
||||
|
||||
@ -32,9 +32,6 @@ import java.util.Map;
|
||||
public class Metrics {
|
||||
private static final String TAG = "Metrics";
|
||||
|
||||
static {
|
||||
System.loadLibrary("jingle_peerconnection_so");
|
||||
}
|
||||
public final Map<String, HistogramInfo> map =
|
||||
new HashMap<String, HistogramInfo>(); // <name, HistogramInfo>
|
||||
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
|
||||
package org.webrtc;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -21,10 +21,6 @@ import java.util.List;
|
||||
* http://www.w3.org/TR/mediacapture-streams/
|
||||
*/
|
||||
public class PeerConnection {
|
||||
static {
|
||||
System.loadLibrary("jingle_peerconnection_so");
|
||||
}
|
||||
|
||||
/** Tracks PeerConnectionInterface::IceGatheringState */
|
||||
public enum IceGatheringState { NEW, GATHERING, COMPLETE }
|
||||
|
||||
|
||||
@ -18,12 +18,6 @@ import java.util.List;
|
||||
* the PeerConnection API for clients.
|
||||
*/
|
||||
public class PeerConnectionFactory {
|
||||
static {
|
||||
// TODO(sakal): Remove once all dependencies have started using
|
||||
// PeerConnectionFactory.initialize.
|
||||
NativeLibrary.initialize(new NativeLibrary.DefaultLoader());
|
||||
}
|
||||
|
||||
public static final String TRIAL_ENABLED = "Enabled";
|
||||
public static final String VIDEO_FRAME_EMIT_TRIAL = "VideoFrameEmit";
|
||||
|
||||
@ -140,24 +134,7 @@ public class PeerConnectionFactory {
|
||||
private static native void nativeInitializeAndroidGlobals(
|
||||
Context context, boolean videoHwAcceleration);
|
||||
|
||||
// Deprecated, use PeerConnectionFactory.initialize instead.
|
||||
@Deprecated
|
||||
public static void initializeAndroidGlobals(Context context, boolean videoHwAcceleration) {
|
||||
ContextUtils.initialize(context);
|
||||
nativeInitializeAndroidGlobals(context, videoHwAcceleration);
|
||||
}
|
||||
|
||||
// Older signature of initializeAndroidGlobals. The extra parameters are now meaningless.
|
||||
// Deprecated, use PeerConnectionFactory.initialize instead.
|
||||
@Deprecated
|
||||
public static boolean initializeAndroidGlobals(Object context, boolean initializeAudio,
|
||||
boolean initializeVideo, boolean videoHwAcceleration) {
|
||||
initializeAndroidGlobals((Context) context, videoHwAcceleration);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void initializeInternalTracer() {
|
||||
private static void initializeInternalTracer() {
|
||||
internalTracerInitialized = true;
|
||||
nativeInitializeInternalTracer();
|
||||
}
|
||||
|
||||
@ -23,10 +23,6 @@ import java.util.concurrent.CountDownLatch;
|
||||
* Can be used to save the video frames to file.
|
||||
*/
|
||||
public class VideoFileRenderer implements VideoRenderer.Callbacks {
|
||||
static {
|
||||
System.loadLibrary("jingle_peerconnection_so");
|
||||
}
|
||||
|
||||
private static final String TAG = "VideoFileRenderer";
|
||||
|
||||
private final HandlerThread renderThread;
|
||||
|
||||
@ -23,11 +23,17 @@ import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import org.chromium.base.test.BaseJUnit4ClassRunner;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BaseJUnit4ClassRunner.class)
|
||||
public class VideoFileRendererTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
NativeLibrary.initialize(new NativeLibrary.DefaultLoader());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SmallTest
|
||||
public void testYuvRenderingToFile() throws InterruptedException, IOException {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user