2020import androidx .annotation .RequiresApi ;
2121
2222import io .getstream .webrtc .flutter .audio .AudioDeviceKind ;
23+ import io .getstream .webrtc .flutter .audio .AudioProcessingFactoryProvider ;
2324import io .getstream .webrtc .flutter .audio .AudioProcessingController ;
2425import io .getstream .webrtc .flutter .audio .AudioSwitchManager ;
2526import io .getstream .webrtc .flutter .audio .AudioUtils ;
2627import io .getstream .webrtc .flutter .audio .LocalAudioTrack ;
27- import io .getstream .webrtc .flutter .audio .PlaybackSamplesReadyCallbackAdapter ;
28+ // import io.getstream.webrtc.flutter.audio.PlaybackSamplesReadyCallbackAdapter;
2829import io .getstream .webrtc .flutter .audio .RecordSamplesReadyCallbackAdapter ;
2930import io .getstream .webrtc .flutter .record .AudioChannel ;
3031import io .getstream .webrtc .flutter .record .FrameCapturer ;
@@ -110,7 +111,7 @@ public class MethodCallHandlerImpl implements MethodCallHandler, StateProvider {
110111
111112 public RecordSamplesReadyCallbackAdapter recordSamplesReadyCallbackAdapter ;
112113
113- public PlaybackSamplesReadyCallbackAdapter playbackSamplesReadyCallbackAdapter ;
114+ // public PlaybackSamplesReadyCallbackAdapter playbackSamplesReadyCallbackAdapter;
114115
115116 /**
116117 * The implementation of {@code getUserMedia} extracted into a separate file in order to reduce
@@ -130,7 +131,7 @@ public class MethodCallHandlerImpl implements MethodCallHandler, StateProvider {
130131
131132 private CustomVideoDecoderFactory videoDecoderFactory ;
132133
133- public AudioProcessingController audioProcessingController ;
134+ public AudioProcessingFactoryProvider audioProcessingFactoryProvider ;
134135
135136 MethodCallHandlerImpl (Context context , BinaryMessenger messenger , TextureRegistry textureRegistry ) {
136137 this .context = context ;
@@ -198,7 +199,7 @@ private void initialize(boolean bypassVoiceProcessing, int networkIgnoreMask, bo
198199 JavaAudioDeviceModule .Builder audioDeviceModuleBuilder = JavaAudioDeviceModule .builder (context );
199200
200201 recordSamplesReadyCallbackAdapter = new RecordSamplesReadyCallbackAdapter ();
201- playbackSamplesReadyCallbackAdapter = new PlaybackSamplesReadyCallbackAdapter ();
202+ // playbackSamplesReadyCallbackAdapter = new PlaybackSamplesReadyCallbackAdapter();
202203
203204 if (bypassVoiceProcessing ) {
204205 audioDeviceModuleBuilder .setUseHardwareAcousticEchoCanceler (false )
@@ -215,7 +216,7 @@ private void initialize(boolean bypassVoiceProcessing, int networkIgnoreMask, bo
215216 }
216217
217218 audioDeviceModuleBuilder .setSamplesReadyCallback (recordSamplesReadyCallbackAdapter );
218- audioDeviceModuleBuilder .setPlaybackSamplesReadyCallback (playbackSamplesReadyCallbackAdapter );
219+ // audioDeviceModuleBuilder.setPlaybackSamplesReadyCallback(playbackSamplesReadyCallbackAdapter);
219220
220221 recordSamplesReadyCallbackAdapter .addCallback (getUserMediaImpl .inputSamplesInterceptor );
221222
@@ -266,9 +267,12 @@ public void onWebRtcAudioRecordSamplesReady(JavaAudioDeviceModule.AudioSamples a
266267 videoEncoderFactory .setForceSWCodec (forceSWCodec );
267268 videoEncoderFactory .setForceSWCodecList (forceSWCodecList );
268269
269- audioProcessingController = new AudioProcessingController ();
270270
271- factoryBuilder .setAudioProcessingFactory (audioProcessingController .externalAudioProcessingFactory );
271+ if (audioProcessingFactoryProvider == null ) {
272+ audioProcessingFactoryProvider = new AudioProcessingController ();
273+ }
274+
275+ factoryBuilder .setAudioProcessingFactory (audioProcessingFactoryProvider .getFactory ());
272276
273277 mFactory = factoryBuilder
274278 .setAudioDeviceModule (audioDeviceModule )
0 commit comments