From a46246c42322a9d9fcc510be5751b66e0c623daa Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 6 May 2024 13:40:10 +0200 Subject: [PATCH] synchronize renegotiate to avoid race condition when that fails --- .../conversations/xmpp/jingle/JingleRtpConnection.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index 695ce20b4..f682f4160 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -2482,7 +2482,7 @@ public class JingleRtpConnection extends AbstractJingleConnection this.webRTCWrapper.execute(this::renegotiate); } - private void renegotiate() { + private synchronized void renegotiate() { final SessionDescription sessionDescription; try { sessionDescription = setLocalSessionDescription(); @@ -2531,10 +2531,11 @@ public class JingleRtpConnection extends AbstractJingleConnection + this.webRTCWrapper.getSignalingState()); } - if (diff.added.size() > 0) { - modifyLocalContentMap(rtpContentMap); - sendContentAdd(rtpContentMap, diff.added); + if (diff.added.isEmpty()) { + return; } + modifyLocalContentMap(rtpContentMap); + sendContentAdd(rtpContentMap, diff.added); } private void initiateIceRestart(final RtpContentMap rtpContentMap) {