Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public boolean isEnded(){
public void close(){
if(peerConnection.connectionState() != PeerConnection.PeerConnectionState.CLOSED) {
peerConnection.dispose();
pcObserver.frameCryptorMap.forEach((k,v) -> v.dispose());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ public void removeAudioTrack(String id) {
AudioTrackInfo audioTrackInfo = audioTracks.get(id);
if (audioTrackInfo == null) return;
peerConnection.removeTrack(audioTrackInfo.sender);
audioTracks.remove(id);

AudioTrackInfo removedAudioTrackInfo = audioTracks.remove(id);
if (removedAudioTrackInfo != null) {
removedAudioTrackInfo.frameCryptor.dispose();
}
}
}

Expand All @@ -99,8 +103,12 @@ public void removeVideoTrack(String id) {
VideoTrackInfo videoTrackInfo = videoTracks.get(id);
if (videoTrackInfo == null) return;
peerConnection.removeTrack(videoTrackInfo.sender);
videoTracks.remove(id);
videoCapturers.remove(id);

VideoTrackInfo removedVideoTrackInfo = videoTracks.remove(id);
if (removedVideoTrackInfo != null) {
removedVideoTrackInfo.frameCryptor.dispose();
}
}
}

Expand Down Expand Up @@ -130,6 +138,8 @@ public void close() {
super.close();
audioTracks.clear();
videoTracks.clear();

videoCapturers.forEach((k, v) -> v.dispose());
videoCapturers.clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,21 @@ public void createHandleToRoom(
}

public void leaveStreamRoom(@NonNull String streamRoomId) {
sessions.remove(streamRoomId);
RoomJanusSession session = sessions.getOrDefault(streamRoomId, null);
if (session != null) {
session.close();
sessions.remove(streamRoomId);
}
}

public void close() {
try {
sessions.forEach((roomId, session) -> session.close());
sessions.clear();
sessionHandles.clear();
} catch (Exception ignored) {}

pcFactory.dispose();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public void setFrameCryptorOptions(PmxFrameCryptor.PmxFrameCryptorOptions option
}
}

public void close(){
// todo - to use this update aar is required
// keyStore.release();
}

public class WebRTCImpl implements WebRTCInterface {
private final ExecutorService executor = Executors.newSingleThreadExecutor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,9 @@ public String buildSubscriptionQuery(
selectorId
);
}

public void close() throws Exception {
pcManager.close();
api.close();
}
}