mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
Improvements to cleanup
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
2e6804dc35
commit
b7539bfc12
@ -978,31 +978,37 @@ public class CallActivity extends AppCompatActivity {
|
||||
if (!dueToNetworkChange) {
|
||||
pipVideoView.release();
|
||||
|
||||
if (localMediaStream != null) {
|
||||
if (localMediaStream.videoTracks != null && localMediaStream.videoTracks.size() > 0) {
|
||||
localMediaStream.removeTrack(localMediaStream.videoTracks.get(0));
|
||||
}
|
||||
|
||||
if (localMediaStream.audioTracks != null && localMediaStream.audioTracks.size() > 0) {
|
||||
localMediaStream.removeTrack(localMediaStream.audioTracks.get(0));
|
||||
}
|
||||
if (audioSource != null) {
|
||||
audioSource.dispose();
|
||||
audioSource = null;
|
||||
}
|
||||
|
||||
if (audioManager != null) {
|
||||
audioManager.stop();
|
||||
audioManager = null;
|
||||
}
|
||||
|
||||
localVideoTrack = null;
|
||||
localAudioTrack = null;
|
||||
localRenderer = null;
|
||||
localMediaStream = null;
|
||||
if (videoCapturer != null) {
|
||||
try {
|
||||
videoCapturer.stopCapture();
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(TAG, "Failed to stop capturing while hanging up");
|
||||
}
|
||||
videoCapturer.dispose();
|
||||
videoCapturer = null;
|
||||
}
|
||||
|
||||
Log.d(TAG, "Closing video source.");
|
||||
if (videoSource != null) {
|
||||
videoSource.dispose();
|
||||
videoSource = null;
|
||||
}
|
||||
|
||||
if (peerConnectionFactory != null) {
|
||||
peerConnectionFactory.dispose();
|
||||
peerConnectionFactory = null;
|
||||
}
|
||||
|
||||
if (videoCapturer != null) {
|
||||
videoCapturer.dispose();
|
||||
videoCapturer = null;
|
||||
}
|
||||
|
||||
hangupNetworkCalls();
|
||||
|
||||
|
@ -93,8 +93,13 @@ public class MagicPeerConnectionWrapper {
|
||||
}
|
||||
|
||||
public void removePeerConnection() {
|
||||
if (magicDataChannel != null) {
|
||||
magicDataChannel.dispose();
|
||||
magicDataChannel = null;
|
||||
}
|
||||
|
||||
if (peerConnection != null) {
|
||||
peerConnection.close();
|
||||
peerConnection.dispose();
|
||||
peerConnection = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user