diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index a052f8b39..592a28d59 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -1409,8 +1409,8 @@ public class RtpSessionActivity extends XmppActivity @Override public void onAudioDeviceChanged( - AppRTCAudioManager.AudioDevice selectedAudioDevice, - Set availableAudioDevices) { + final AppRTCAudioManager.AudioDevice selectedAudioDevice, + final Set availableAudioDevices) { Log.d( Config.LOGTAG, "onAudioDeviceChanged in activity: selected:" @@ -1418,24 +1418,26 @@ public class RtpSessionActivity extends XmppActivity + ", available:" + availableAudioDevices); try { - if (getMedia().contains(Media.VIDEO)) { - Log.d(Config.LOGTAG, "nothing to do; in video mode"); - return; - } final RtpEndUserState endUserState = requireRtpConnection().getEndUserState(); - if (endUserState == RtpEndUserState.CONNECTED) { - final AppRTCAudioManager audioManager = requireRtpConnection().getAudioManager(); - updateInCallButtonConfigurationSpeaker( - audioManager.getSelectedAudioDevice(), - audioManager.getAudioDevices().size()); - } else if (END_CARD.contains(endUserState)) { + final Set media = getMedia(); + if (END_CARD.contains(endUserState)) { Log.d( Config.LOGTAG, "onAudioDeviceChanged() nothing to do because end card has been reached"); } else { + if (Media.audioOnly(media) && endUserState == RtpEndUserState.CONNECTED) { + final AppRTCAudioManager audioManager = + requireRtpConnection().getAudioManager(); + updateInCallButtonConfigurationSpeaker( + audioManager.getSelectedAudioDevice(), + audioManager.getAudioDevices().size()); + } + Log.d( + Config.LOGTAG, + "put proximity wake lock into proper state after device update"); putProximityWakeLockInProperState(selectedAudioDevice); } - } catch (IllegalStateException e) { + } catch (final IllegalStateException e) { Log.d(Config.LOGTAG, "RTP connection was not available when audio device changed"); } } diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java index 6c270fbad..d2979d57e 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -433,9 +433,14 @@ public class WebRTCWrapper { public void setIsReadyToReceiveIceCandidates(final boolean ready) { readyToReceivedIceCandidates.set(ready); + final int was = iceCandidates.size(); while (ready && iceCandidates.peek() != null) { eventCallback.onIceCandidate(iceCandidates.poll()); } + final int is = iceCandidates.size(); + Log.d( + EXTENDED_LOGGING_TAG, + "setIsReadyToReceiveCandidates(" + ready + ") was=" + was + " is=" + is); } synchronized void close() {