Skip to content

Commit

Permalink
Free the ice4j agent before recreating a new one
Browse files Browse the repository at this point in the history
Since the old agent might not be shutdown and garbage collected immediately, there might be some Stun-related resource blocked.
  • Loading branch information
Brutus5000 committed Nov 19, 2023
1 parent 2fbfe30 commit 6b4d479
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ synchronized void initiateIce() {
* Creates an agent and media stream for handling the ICE
*/
private void createAgent() {
if(agent != null) {
agent.free();
}

agent = new Agent();
agent.setControlling(peer.isLocalOffer());

Expand Down

0 comments on commit 6b4d479

Please sign in to comment.