From 64813992934cceaef754f3f937d53572b7105141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Sun, 18 Sep 2022 14:16:51 +0200 Subject: [PATCH] Fix disposing local stream when the call activity is not being left MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The local stream is set only when the activity is created. However, it was disposed when hanging up, which happens not only when closing the activity, but also in cases in which the call activity is kept open and the participant reconnects to the call (for example, when starting the call times out), which caused the local stream to freeze. Now the local stream is disposed only when the call activity is destroyed. Signed-off-by: Daniel Calviño Sánchez --- .../nextcloud/talk/activities/CallActivity.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java index 0f691f353..d2c277c38 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java @@ -1166,6 +1166,14 @@ public class CallActivity extends CallBaseActivity { @Override public void onDestroy() { + if (localStream != null) { + localStream.dispose(); + localStream = null; + Log.d(TAG, "Disposed localStream"); + } else { + Log.d(TAG, "localStream is null"); + } + if (!currentCallStatus.equals(CallStatus.LEAVING)) { setCallState(CallStatus.LEAVING); hangup(true); @@ -1711,14 +1719,6 @@ public class CallActivity extends CallBaseActivity { endPeerConnection(wrapper.getSessionId(), false); } - if (localStream != null) { - localStream.dispose(); - localStream = null; - Log.d(TAG, "Disposed localStream"); - } else { - Log.d(TAG, "localStream is null"); - } - hangupNetworkCalls(shutDownView); ApplicationWideCurrentRoomHolder.getInstance().setInCall(false); }