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:
Piotr (Peter) Slatala
2018-10-16 08:22:58 -07:00
committed by Commit Bot
parent 9b1d67982f
commit 4e5074e0d2
4 changed files with 60 additions and 11 deletions

View File

@ -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);