avoid race condition when restarting ICE

This commit is contained in:
Daniel Gultsch 2022-11-30 17:32:46 +01:00
parent 16f140572f
commit 80d195d35e

View file

@ -415,12 +415,20 @@ public class WebRTCWrapper {
}
void restartIce() {
executorService.execute(() -> {
final PeerConnection peerConnection = requirePeerConnection();
setIsReadyToReceiveIceCandidates(false);
peerConnection.restartIce();
requirePeerConnection().restartIce();}
);
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();
});
}
public void setIsReadyToReceiveIceCandidates(final boolean ready) {