Add a CreateNetEq method that takes an AudioDecoderFactory

The NetEqFactory is currently expected to wrap the AudioDecoderFactory,
but this turns out not to be a good idea. Instead, it makes more sense
to pass the AudioDecoderFactory through the CreateNetEq method.

Bug: webrtc:11005
Change-Id: I8027ff6593f40c92072e7e88157631dcf329a984
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160644
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29918}
This commit is contained in:
Ivo Creusen
2019-11-26 12:29:05 +01:00
committed by Commit Bot
parent fdaba6cf16
commit 68c6572980
10 changed files with 144 additions and 25 deletions

View File

@ -167,7 +167,6 @@ public class PeerConnectionFactory {
@Nullable private AudioDeviceModule audioDeviceModule;
private AudioEncoderFactoryFactory audioEncoderFactoryFactory =
new BuiltinAudioEncoderFactoryFactory();
@Nullable
private AudioDecoderFactoryFactory audioDecoderFactoryFactory =
new BuiltinAudioDecoderFactoryFactory();
@Nullable private VideoEncoderFactory videoEncoderFactory;
@ -201,7 +200,6 @@ public class PeerConnectionFactory {
return this;
}
@Deprecated
public Builder setAudioDecoderFactoryFactory(
AudioDecoderFactoryFactory audioDecoderFactoryFactory) {
if (audioDecoderFactoryFactory == null) {
@ -263,7 +261,6 @@ public class PeerConnectionFactory {
* NetEqFactoryFactory.
*/
public Builder setNetEqFactoryFactory(NetEqFactoryFactory neteqFactoryFactory) {
this.audioDecoderFactoryFactory = null;
this.neteqFactoryFactory = neteqFactoryFactory;
return this;
}
@ -274,18 +271,11 @@ public class PeerConnectionFactory {
audioDeviceModule = JavaAudioDeviceModule.builder(ContextUtils.getApplicationContext())
.createAudioDeviceModule();
}
if (neteqFactoryFactory == null && audioDecoderFactoryFactory == null) {
throw new IllegalStateException(
"Setting both audioDecoderFactoryFactory and neteqFactoryFactory "
+ "to null is not allowed.");
}
return nativeCreatePeerConnectionFactory(ContextUtils.getApplicationContext(), options,
audioDeviceModule.getNativeAudioDeviceModulePointer(),
audioEncoderFactoryFactory.createNativeAudioEncoderFactory(),
audioDecoderFactoryFactory == null
? 0
: audioDecoderFactoryFactory.createNativeAudioDecoderFactory(),
videoEncoderFactory, videoDecoderFactory,
audioDecoderFactoryFactory.createNativeAudioDecoderFactory(), videoEncoderFactory,
videoDecoderFactory,
audioProcessingFactory == null ? 0 : audioProcessingFactory.createNative(),
fecControllerFactoryFactory == null ? 0 : fecControllerFactoryFactory.createNative(),
networkControllerFactoryFactory == null