avoid race condition when restarting ICE

(cherry picked from commit 80d195d35eba1d1b12f9efbb86734c33d234ad61)
This commit is contained in:
Daniel Gultsch 2022-11-30 17:32:46 +01:00 committed by Arne
parent f9126c87d4
commit 5ac7c9ca2c

View file

@ -423,12 +423,20 @@ public class WebRTCWrapper {
}
void restartIce() {
executorService.execute(() -> {
final PeerConnection peerConnection = requirePeerConnection();
executorService.execute(
() -> {
final PeerConnection peerConnection;
try {
peerConnection = requirePeerConnection();
} catch (final PeerConnectionNotInitialized e) {
Log.w(
EXTENDED_LOGGING_TAG,
"PeerConnection vanished before we could execute restart");
return;
}
setIsReadyToReceiveIceCandidates(false);
peerConnection.restartIce();
requirePeerConnection().restartIce();}
);
});
}
public void setIsReadyToReceiveIceCandidates(final boolean ready) {