Allow passing in a custom native library loader.

All previous initialize methods are deprecated and a new initialize
that uses a builder pattern is added. This gives us full control over
the order of initialization.

Bug: webrtc:7474
Change-Id: I006190e50f2e75c5015f0be75b86d367676db2cc
Reviewed-on: https://webrtc-review.googlesource.com/4160
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20037}
This commit is contained in:
Sami Kalliomäki
2017-09-29 12:49:46 +02:00
committed by Commit Bot
parent 7bcfc3b232
commit 5cd1cfb7c4
7 changed files with 190 additions and 65 deletions

View File

@ -378,14 +378,6 @@ public class PeerConnectionClient {
}
private void createPeerConnectionFactoryInternal(Context context) {
PeerConnectionFactory.initializeInternalTracer();
if (peerConnectionParameters.tracing) {
PeerConnectionFactory.startInternalTracingCapture(
Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator
+ "webrtc-trace.txt");
}
Log.d(TAG,
"Create peer connection factory. Use video: " + peerConnectionParameters.videoCallEnabled);
isError = false;
// Initialize field trials.
@ -424,8 +416,21 @@ public class PeerConnectionClient {
}
}
Log.d(TAG, "Preferred video codec: " + preferredVideoCodec);
PeerConnectionFactory.initializeFieldTrials(fieldTrials);
Log.d(TAG, "Field trials: " + fieldTrials);
// Initialize WebRTC
Log.d(TAG,
"Initialize WebRTC. Field trials: " + fieldTrials + " Enable video HW acceleration: "
+ peerConnectionParameters.videoCodecHwAcceleration);
PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions.builder(context)
.setFieldTrials(fieldTrials)
.setEnableVideoHwAcceleration(peerConnectionParameters.videoCodecHwAcceleration)
.createInitializationOptions());
if (peerConnectionParameters.tracing) {
PeerConnectionFactory.startInternalTracingCapture(
Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator
+ "webrtc-trace.txt");
}
// Check if ISAC is used by default.
preferIsac = peerConnectionParameters.audioCodec != null
@ -504,8 +509,6 @@ public class PeerConnectionClient {
});
// Create peer connection factory.
PeerConnectionFactory.initializeAndroidGlobals(
context, peerConnectionParameters.videoCodecHwAcceleration);
if (options != null) {
Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMask);
}