webrtc/sdk/android/native_unittests/org/webrtc/PeerConnectionFactoryInitializationHelper.java
Artem Titov 70899e012f Add support for creating java PCF from native one.
Add support for creating java PeerConnectionFactory from native one
by adding:
1. Constructor from native pointer in java PeerConnectionFactory
2. Method NativeToJavaPeerConnectionFactory in
sdk/android/native/api/peerconnection/peerconnectionfactory.h that
provides ability to convert native factory to java one.

Bug: webrtc:8946
Change-Id: Ibe8b019bd0d45849e2b16d74663d054784526746
Reviewed-on: https://webrtc-review.googlesource.com/62344
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22564}
2018-03-22 13:37:24 +00:00

33 lines
1.1 KiB
Java

/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
import android.content.Context;
import org.webrtc.PeerConnectionFactory.InitializationOptions;
public class PeerConnectionFactoryInitializationHelper {
private static class MockLoader implements NativeLibraryLoader {
@Override
public boolean load(String name) {
return true;
}
}
@CalledByNative
public static void initializeFactoryForTests() {
Context ctx = ContextUtils.getApplicationContext();
InitializationOptions options = InitializationOptions.builder(ctx)
.setNativeLibraryLoader(new MockLoader())
.createInitializationOptions();
PeerConnectionFactory.initialize(options);
}
}