Ensure speakerphone is correctly enabled during call setup.

Race condition between handleStartOutgoingCall being enqueued from ringrtc and
handleSetEnableVideo being enqueued from the main thread.
This commit is contained in:
Cody Henthorne 2020-10-27 17:01:31 -04:00 committed by Greyson Parrelli
parent dfc4178252
commit cf2189c11a
3 changed files with 4 additions and 1 deletions

View File

@ -75,6 +75,8 @@ public class CallSetupActionProcessorDelegate extends WebRtcActionProcessor {
@Override
protected @NonNull WebRtcServiceState handleSetEnableVideo(@NonNull WebRtcServiceState currentState, boolean enable) {
Log.i(tag, "handleSetEnableVideo(): enable: " + enable);
Camera camera = currentState.getVideoState().requireCamera();
if (camera.isInitialized()) {

View File

@ -66,6 +66,7 @@ public class OutgoingCallActionProcessor extends DeviceAwareActionProcessor {
AudioManager androidAudioManager = ServiceUtil.getAudioManager(context);
androidAudioManager.setSpeakerphoneOn(false);
WebRtcUtil.enableSpeakerPhoneIfNeeded(context, currentState.getCallSetupState().isEnableVideoOnCreate());
webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context));
webRtcInteractor.initializeAudioForCall();

View File

@ -58,7 +58,7 @@ public class PreJoinActionProcessor extends DeviceAwareActionProcessor {
@SuppressWarnings("ConstantConditions")
@Override
protected @NonNull WebRtcServiceState handleSetEnableVideo(@NonNull WebRtcServiceState currentState, boolean enable) {
Log.w(TAG, "handleSetEnableVideo(): Changing for pre-join call.");
Log.i(TAG, "handleSetEnableVideo(): Changing for pre-join call.");
currentState.getVideoState().getCamera().setEnabled(enable);
return currentState.builder()