Add MediaTransportInterface factory to the Jni bindings
Java apps currently have no way of setting MediaTransportInterface on the PeerConnectionFactory. This change adds that ability. Bug: webrtc:9719 Change-Id: I312893a153b5b3d978912cba4db60cd97001c8f3 Reviewed-on: https://webrtc-review.googlesource.com/c/105740 Commit-Queue: Peter Slatala <psla@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25217}
This commit is contained in:
committed by
Commit Bot
parent
9b1d67982f
commit
4e5074e0d2
22
sdk/android/api/org/webrtc/MediaTransportFactoryFactory.java
Normal file
22
sdk/android/api/org/webrtc/MediaTransportFactoryFactory.java
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 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;
|
||||
|
||||
/**
|
||||
* Factory for creating webrtc::MediaTransportFactory instances.
|
||||
*/
|
||||
public interface MediaTransportFactoryFactory {
|
||||
/**
|
||||
* Dynamically allocates a webrtc::MediaTransportFactory instance and returns a pointer to it.
|
||||
* The caller takes ownership of the object.
|
||||
*/
|
||||
public long createNativeMediaTransportFactory();
|
||||
}
|
||||
@ -158,6 +158,7 @@ public class PeerConnectionFactory {
|
||||
private @Nullable VideoDecoderFactory decoderFactory;
|
||||
private @Nullable AudioProcessingFactory audioProcessingFactory;
|
||||
private @Nullable FecControllerFactoryFactoryInterface fecControllerFactoryFactory;
|
||||
private @Nullable MediaTransportFactoryFactory mediaTransportFactoryFactory;
|
||||
|
||||
private Builder() {}
|
||||
|
||||
@ -196,9 +197,16 @@ public class PeerConnectionFactory {
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets a MediaTransportFactoryFactory for a PeerConnectionFactory. */
|
||||
public Builder setMediaTransportFactoryFactory(
|
||||
MediaTransportFactoryFactory mediaTransportFactoryFactory) {
|
||||
this.mediaTransportFactoryFactory = mediaTransportFactoryFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PeerConnectionFactory createPeerConnectionFactory() {
|
||||
return new PeerConnectionFactory(options, audioDeviceModule, encoderFactory, decoderFactory,
|
||||
audioProcessingFactory, fecControllerFactoryFactory);
|
||||
audioProcessingFactory, fecControllerFactoryFactory, mediaTransportFactoryFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,13 +287,17 @@ public class PeerConnectionFactory {
|
||||
private PeerConnectionFactory(Options options, @Nullable AudioDeviceModule audioDeviceModule,
|
||||
@Nullable VideoEncoderFactory encoderFactory, @Nullable VideoDecoderFactory decoderFactory,
|
||||
@Nullable AudioProcessingFactory audioProcessingFactory,
|
||||
@Nullable FecControllerFactoryFactoryInterface fecControllerFactoryFactory) {
|
||||
@Nullable FecControllerFactoryFactoryInterface fecControllerFactoryFactory,
|
||||
@Nullable MediaTransportFactoryFactory mediaTransportFactoryFactory) {
|
||||
checkInitializeHasBeenCalled();
|
||||
nativeFactory = nativeCreatePeerConnectionFactory(ContextUtils.getApplicationContext(), options,
|
||||
audioDeviceModule == null ? 0 : audioDeviceModule.getNativeAudioDeviceModulePointer(),
|
||||
encoderFactory, decoderFactory,
|
||||
audioProcessingFactory == null ? 0 : audioProcessingFactory.createNative(),
|
||||
fecControllerFactoryFactory == null ? 0 : fecControllerFactoryFactory.createNative());
|
||||
fecControllerFactoryFactory == null ? 0 : fecControllerFactoryFactory.createNative(),
|
||||
mediaTransportFactoryFactory == null
|
||||
? 0
|
||||
: mediaTransportFactoryFactory.createNativeMediaTransportFactory());
|
||||
if (nativeFactory == 0) {
|
||||
throw new RuntimeException("Failed to initialize PeerConnectionFactory!");
|
||||
}
|
||||
@ -489,7 +501,7 @@ public class PeerConnectionFactory {
|
||||
private static native long nativeCreatePeerConnectionFactory(Context context, Options options,
|
||||
long nativeAudioDeviceModule, VideoEncoderFactory encoderFactory,
|
||||
VideoDecoderFactory decoderFactory, long nativeAudioProcessor,
|
||||
long nativeFecControllerFactory);
|
||||
long nativeFecControllerFactory, long mediaTransportFactory);
|
||||
private static native long nativeCreatePeerConnection(long factory,
|
||||
PeerConnection.RTCConfiguration rtcConfig, MediaConstraints constraints, long nativeObserver,
|
||||
SSLCertificateVerifier sslCertificateVerifier);
|
||||
|
||||
Reference in New Issue
Block a user