mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 16:19:33 +01:00
Use low-bandwidth mode if call is believed to be on cellular
This commit is contained in:
committed by
Cody Henthorne
parent
60047aecb9
commit
7dc3454b37
@@ -66,7 +66,6 @@ public class CallSetupActionProcessorDelegate extends WebRtcActionProcessor {
|
||||
callManager.setCommunicationMode();
|
||||
callManager.setAudioEnable(currentState.getLocalDeviceState().isMicrophoneEnabled());
|
||||
callManager.setVideoEnable(currentState.getLocalDeviceState().getCameraState().isEnabled());
|
||||
callManager.updateBandwidthMode(NetworkUtil.getCallingBandwidthMode(context));
|
||||
} catch (CallException e) {
|
||||
return callFailure(currentState, "Enabling audio/video failed: ", e);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class GroupJoiningActionProcessor extends GroupActionProcessor {
|
||||
try {
|
||||
groupCall.setOutgoingVideoMuted(!currentState.getLocalDeviceState().getCameraState().isEnabled());
|
||||
groupCall.setOutgoingAudioMuted(!currentState.getLocalDeviceState().isMicrophoneEnabled());
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context));
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, device.getNetworkRoute().getLocalAdapterType()));
|
||||
} catch (CallException e) {
|
||||
Log.e(tag, e);
|
||||
throw new RuntimeException(e);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
|
||||
try {
|
||||
groupCall.setOutgoingAudioMuted(true);
|
||||
groupCall.setOutgoingVideoMuted(true);
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context));
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
|
||||
Log.i(TAG, "Connecting to group call: " + currentState.getCallInfoState().getCallRecipient().getId());
|
||||
groupCall.connect();
|
||||
@@ -158,7 +158,7 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
|
||||
groupCall.setOutgoingVideoSource(currentState.getVideoState().requireLocalSink(), currentState.getVideoState().requireCamera());
|
||||
groupCall.setOutgoingVideoMuted(!currentState.getLocalDeviceState().getCameraState().isEnabled());
|
||||
groupCall.setOutgoingAudioMuted(!currentState.getLocalDeviceState().isMicrophoneEnabled());
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context));
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
|
||||
groupCall.join();
|
||||
} catch (CallException e) {
|
||||
|
||||
@@ -176,7 +176,7 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
|
||||
try {
|
||||
groupCall.setOutgoingAudioMuted(true);
|
||||
groupCall.setOutgoingVideoMuted(true);
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context));
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
|
||||
Log.i(TAG, "Connecting to group call: " + currentState.getCallInfoState().getCallRecipient().getId());
|
||||
groupCall.connect();
|
||||
@@ -202,7 +202,7 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
|
||||
groupCall.setOutgoingVideoSource(currentState.getVideoState().requireLocalSink(), currentState.getVideoState().requireCamera());
|
||||
groupCall.setOutgoingVideoMuted(answerWithVideo);
|
||||
groupCall.setOutgoingAudioMuted(!currentState.getLocalDeviceState().isMicrophoneEnabled());
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context));
|
||||
groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
|
||||
|
||||
groupCall.join();
|
||||
} catch (CallException e) {
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
||||
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState;
|
||||
import org.thoughtcrime.securesms.util.AppForegroundObserver;
|
||||
import org.thoughtcrime.securesms.util.BubbleUtil;
|
||||
import org.thoughtcrime.securesms.util.NetworkUtil;
|
||||
import org.thoughtcrime.securesms.util.RecipientAccessList;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
@@ -484,6 +485,11 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||
|
||||
@Override public void onNetworkRouteChanged(Remote remote, NetworkRoute networkRoute) {
|
||||
Log.i(TAG, "onNetworkRouteChanged: localAdapterType: " + networkRoute.getLocalAdapterType());
|
||||
try {
|
||||
callManager.updateBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, networkRoute.getLocalAdapterType()));
|
||||
} catch (CallException e) {
|
||||
Log.w(TAG, "Unable to update bandwidth mode on CallManager", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user