浏览代码

Fix disposing local stream when the call activity is not being left

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 <danxuliu@gmail.com>
Daniel Calviño Sánchez 2 年之前
父节点
当前提交
6481399293
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 8 8
      app/src/main/java/com/nextcloud/talk/activities/CallActivity.java

+ 8 - 8
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);
     }