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>
This commit is contained in:
Daniel Calviño Sánchez 2022-09-18 14:16:51 +02:00
parent 53e3543839
commit 6481399293

View File

@ -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);
}