Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122. Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before. Original change's description: > Revert "Enables PeerConnectionFactory using external fec controller" > > This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3. > > Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java > > Original change's description: > > Enables PeerConnectionFactory using external fec controller > > > > Bug: webrtc:8799 > > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8 > > Reviewed-on: https://webrtc-review.googlesource.com/43961 > > Commit-Queue: Ying Wang <yinwa@webrtc.org> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org> > > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#22038} > > TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org > > Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:8799 > Reviewed-on: https://webrtc-review.googlesource.com/54080 > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> > Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22040} TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org Bug: webrtc:8799 Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8 Reviewed-on: https://webrtc-review.googlesource.com/55400 Commit-Queue: Ying Wang <yinwa@webrtc.org> Reviewed-by: Ying Wang <yinwa@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22100}
This commit is contained in:
@ -642,6 +642,7 @@ rtc_android_library("libjingle_peerconnection_java") {
|
||||
"api/org/webrtc/EglBase.java",
|
||||
"api/org/webrtc/EglRenderer.java",
|
||||
"api/org/webrtc/EncodedImage.java",
|
||||
"api/org/webrtc/FecControllerFactoryFactoryInterface.java",
|
||||
"api/org/webrtc/FileVideoCapturer.java",
|
||||
"api/org/webrtc/GlRectDrawer.java",
|
||||
"api/org/webrtc/GlShader.java",
|
||||
|
||||
@ -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::FecControllerFactory instances.
|
||||
*/
|
||||
public interface FecControllerFactoryFactoryInterface {
|
||||
/**
|
||||
* Dynamically allocates a webrtc::FecControllerFactory instance and returns a pointer to it.
|
||||
* The caller takes ownership of the object.
|
||||
*/
|
||||
public long createNative();
|
||||
}
|
||||
@ -124,6 +124,55 @@ public class PeerConnectionFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Options options;
|
||||
private VideoEncoderFactory encoderFactory;
|
||||
private VideoDecoderFactory decoderFactory;
|
||||
private AudioProcessingFactory audioProcessingFactory;
|
||||
private FecControllerFactoryFactoryInterface fecControllerFactoryFactory;
|
||||
|
||||
private Builder() {}
|
||||
|
||||
public Builder setOptions(Options options) {
|
||||
this.options = options;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setVideoEncoderFactory(VideoEncoderFactory encoderFactory) {
|
||||
this.encoderFactory = encoderFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setVideoDecoderFactory(VideoDecoderFactory decoderFactory) {
|
||||
this.decoderFactory = decoderFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAudioProcessingFactory(AudioProcessingFactory audioProcessingFactory) {
|
||||
if (audioProcessingFactory == null) {
|
||||
throw new NullPointerException(
|
||||
"PeerConnectionFactory builder does not accept a null AudioProcessingFactory.");
|
||||
}
|
||||
this.audioProcessingFactory = audioProcessingFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setFecControllerFactoryFactoryInterface(
|
||||
FecControllerFactoryFactoryInterface fecControllerFactoryFactory) {
|
||||
this.fecControllerFactoryFactory = fecControllerFactoryFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PeerConnectionFactory createPeerConnectionFactory() {
|
||||
return new PeerConnectionFactory(options, encoderFactory, decoderFactory,
|
||||
audioProcessingFactory, fecControllerFactoryFactory);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and initializes WebRTC. This must be called at least once before creating a
|
||||
* PeerConnectionFactory. Replaces all the old initialization methods. Must not be called while
|
||||
@ -191,28 +240,36 @@ public class PeerConnectionFactory {
|
||||
|
||||
// Note: initializeAndroidGlobals must be called at least once before
|
||||
// constructing a PeerConnectionFactory.
|
||||
@Deprecated
|
||||
public PeerConnectionFactory(Options options) {
|
||||
this(options, null /* encoderFactory */, null /* decoderFactory */);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public PeerConnectionFactory(
|
||||
Options options, VideoEncoderFactory encoderFactory, VideoDecoderFactory decoderFactory) {
|
||||
checkInitializeHasBeenCalled();
|
||||
nativeFactory = nativeCreatePeerConnectionFactory(options, encoderFactory, decoderFactory);
|
||||
nativeFactory =
|
||||
nativeCreatePeerConnectionFactory(options, encoderFactory, decoderFactory, 0, 0);
|
||||
if (nativeFactory == 0) {
|
||||
throw new RuntimeException("Failed to initialize PeerConnectionFactory!");
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public PeerConnectionFactory(Options options, VideoEncoderFactory encoderFactory,
|
||||
VideoDecoderFactory decoderFactory, AudioProcessingFactory audioProcessingFactory) {
|
||||
this(options, encoderFactory, decoderFactory, audioProcessingFactory,
|
||||
null /* fecControllerFactoryFactory */);
|
||||
}
|
||||
|
||||
private PeerConnectionFactory(Options options, VideoEncoderFactory encoderFactory,
|
||||
VideoDecoderFactory decoderFactory, AudioProcessingFactory audioProcessingFactory,
|
||||
FecControllerFactoryFactoryInterface fecControllerFactoryFactory) {
|
||||
checkInitializeHasBeenCalled();
|
||||
if (audioProcessingFactory == null) {
|
||||
throw new NullPointerException(
|
||||
"PeerConnectionFactory constructor does not accept a null AudioProcessingFactory.");
|
||||
}
|
||||
nativeFactory = nativeCreatePeerConnectionFactoryWithAudioProcessing(
|
||||
options, encoderFactory, decoderFactory, audioProcessingFactory.createNative());
|
||||
nativeFactory = nativeCreatePeerConnectionFactory(options, encoderFactory, decoderFactory,
|
||||
audioProcessingFactory == null ? 0 : audioProcessingFactory.createNative(),
|
||||
fecControllerFactoryFactory == null ? 0 : fecControllerFactoryFactory.createNative());
|
||||
if (nativeFactory == 0) {
|
||||
throw new RuntimeException("Failed to initialize PeerConnectionFactory!");
|
||||
}
|
||||
@ -405,11 +462,9 @@ public class PeerConnectionFactory {
|
||||
private static native void nativeShutdownInternalTracer();
|
||||
private static native boolean nativeStartInternalTracingCapture(String tracingFilename);
|
||||
private static native void nativeStopInternalTracingCapture();
|
||||
private static native long nativeCreatePeerConnectionFactory(
|
||||
Options options, VideoEncoderFactory encoderFactory, VideoDecoderFactory decoderFactory);
|
||||
private static native long nativeCreatePeerConnectionFactoryWithAudioProcessing(Options options,
|
||||
private static native long nativeCreatePeerConnectionFactory(Options options,
|
||||
VideoEncoderFactory encoderFactory, VideoDecoderFactory decoderFactory,
|
||||
long nativeAudioProcessor);
|
||||
long nativeAudioProcessor, long nativeFecControllerFactory);
|
||||
private static native long nativeCreatePeerConnection(long factory,
|
||||
PeerConnection.RTCConfiguration rtcConfig, MediaConstraints constraints, long nativeObserver);
|
||||
private static native long nativeCreateLocalMediaStream(long factory, String label);
|
||||
|
||||
@ -172,7 +172,8 @@ jlong CreatePeerConnectionFactoryForJava(
|
||||
const JavaParamRef<jobject>& joptions,
|
||||
const JavaParamRef<jobject>& jencoder_factory,
|
||||
const JavaParamRef<jobject>& jdecoder_factory,
|
||||
rtc::scoped_refptr<AudioProcessing> audio_processor) {
|
||||
rtc::scoped_refptr<AudioProcessing> audio_processor,
|
||||
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory) {
|
||||
// talk/ assumes pretty widely that the current Thread is ThreadManager'd, but
|
||||
// ThreadManager only WrapCurrentThread()s the thread where it is first
|
||||
// created. Since the semantics around when auto-wrapping happens in
|
||||
@ -269,7 +270,7 @@ jlong CreatePeerConnectionFactoryForJava(
|
||||
CreateModularPeerConnectionFactory(
|
||||
network_thread.get(), worker_thread.get(), signaling_thread.get(),
|
||||
std::move(media_engine), std::move(call_factory),
|
||||
std::move(rtc_event_log_factory)));
|
||||
std::move(rtc_event_log_factory), std::move(fec_controller_factory)));
|
||||
RTC_CHECK(factory) << "Failed to create the peer connection factory; "
|
||||
<< "WebRTC/libjingle init likely failed on this device";
|
||||
// TODO(honghaiz): Maybe put the options as the argument of
|
||||
@ -286,29 +287,22 @@ jlong CreatePeerConnectionFactoryForJava(
|
||||
}
|
||||
|
||||
static jlong JNI_PeerConnectionFactory_CreatePeerConnectionFactory(
|
||||
JNIEnv* jni,
|
||||
const JavaParamRef<jclass>&,
|
||||
const JavaParamRef<jobject>& joptions,
|
||||
const JavaParamRef<jobject>& jencoder_factory,
|
||||
const JavaParamRef<jobject>& jdecoder_factory) {
|
||||
return CreatePeerConnectionFactoryForJava(jni, joptions, jencoder_factory,
|
||||
jdecoder_factory,
|
||||
CreateAudioProcessing());
|
||||
}
|
||||
|
||||
static jlong
|
||||
JNI_PeerConnectionFactory_CreatePeerConnectionFactoryWithAudioProcessing(
|
||||
JNIEnv* jni,
|
||||
const JavaParamRef<jclass>&,
|
||||
const JavaParamRef<jobject>& joptions,
|
||||
const JavaParamRef<jobject>& jencoder_factory,
|
||||
const JavaParamRef<jobject>& jdecoder_factory,
|
||||
jlong native_audio_processor) {
|
||||
jlong native_audio_processor,
|
||||
jlong native_fec_controller_factory) {
|
||||
rtc::scoped_refptr<AudioProcessing> audio_processor =
|
||||
reinterpret_cast<AudioProcessing*>(native_audio_processor);
|
||||
RTC_DCHECK(audio_processor);
|
||||
return CreatePeerConnectionFactoryForJava(jni, joptions, jencoder_factory,
|
||||
jdecoder_factory, audio_processor);
|
||||
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory(
|
||||
reinterpret_cast<FecControllerFactoryInterface*>(
|
||||
native_fec_controller_factory));
|
||||
return CreatePeerConnectionFactoryForJava(
|
||||
jni, joptions, jencoder_factory, jdecoder_factory,
|
||||
audio_processor ? audio_processor : CreateAudioProcessing(),
|
||||
std::move(fec_controller_factory));
|
||||
}
|
||||
|
||||
static void JNI_PeerConnectionFactory_FreeFactory(JNIEnv*,
|
||||
|
||||
Reference in New Issue
Block a user