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() { void restartIce() {
executorService.execute(() -> { executorService.execute(
final PeerConnection peerConnection = requirePeerConnection(); () -> {
setIsReadyToReceiveIceCandidates(false); final PeerConnection peerConnection;
peerConnection.restartIce(); try {
requirePeerConnection().restartIce();} 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) { public void setIsReadyToReceiveIceCandidates(final boolean ready) {