fix rare crashes in call integration

This commit is contained in:
Daniel Gultsch 2024-04-08 14:12:30 +02:00
parent 4968bde774
commit 96bf407bf0
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
3 changed files with 11 additions and 2 deletions

View file

@ -297,7 +297,8 @@ public class CallIntegration extends Connection {
} }
private AudioDevice getAudioDeviceFallback() { private AudioDevice getAudioDeviceFallback() {
return requireAppRtcAudioManager().getSelectedAudioDevice(); final var audioDevice = requireAppRtcAudioManager().getSelectedAudioDevice();
return audioDevice == null ? AudioDevice.NONE : audioDevice;
} }
private void setAudioDeviceFallback(final AudioDevice audioDevice) { private void setAudioDeviceFallback(final AudioDevice audioDevice) {

View file

@ -128,6 +128,12 @@ public class CallIntegrationConnectionService extends ConnectionService {
final var proposal = final var proposal =
service.getJingleConnectionManager() service.getJingleConnectionManager()
.proposeJingleRtpSession(account, with, media); .proposeJingleRtpSession(account, with, media);
if (proposal == null) {
// TODO instead of just null checking try to get the sessionID
return Connection.createFailedConnection(
new DisconnectCause(
DisconnectCause.ERROR, "a call is already in progress"));
}
intent.putExtra( intent.putExtra(
RtpSessionActivity.EXTRA_LAST_REPORTED_STATE, RtpSessionActivity.EXTRA_LAST_REPORTED_STATE,
RtpEndUserState.FINDING_DEVICE.toString()); RtpEndUserState.FINDING_DEVICE.toString());

View file

@ -4,6 +4,8 @@ import android.telecom.VideoProfile;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import androidx.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
@ -727,7 +729,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
return rtpConnection; return rtpConnection;
} }
public RtpSessionProposal proposeJingleRtpSession( public @Nullable RtpSessionProposal proposeJingleRtpSession(
final Account account, final Jid with, final Set<Media> media) { final Account account, final Jid with, final Set<Media> media) {
synchronized (this.rtpSessionProposals) { synchronized (this.rtpSessionProposals) {
for (final Map.Entry<RtpSessionProposal, DeviceDiscoveryState> entry : for (final Map.Entry<RtpSessionProposal, DeviceDiscoveryState> entry :