From 53c9c1cf8c50e379b575211f744c5e76eed6f8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 12 Jan 2023 17:52:21 +0100 Subject: [PATCH] Do not create offer for received screen share MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the HPB is not used and a PeerConnectionWrapper is created it always sent an offer if the local session ID is higher than the remote session ID. However, in the case of screen shares the participant sharing the screen always sends an offer, no matter the session ID. Therefore, when that offer was received the new PeerConnectionWrapper object sent a new offer, which in turn created an extra connection in the browser. Although the screen share connection happens to work the underlying behaviour was wrong, so now no offer is sent for received screen share connections and it is always waited until the offer is sent by the other participant. Signed-off-by: Daniel Calviño Sánchez --- .../java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java b/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java index d040d033c..231b2dc30 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java @@ -181,7 +181,9 @@ public class PeerConnectionWrapper { // set the recipient session ID in the assembled call message. NCSignalingMessage ncSignalingMessage = createBaseSignalingMessage("requestoffer"); signalingMessageSender.send(ncSignalingMessage); - } else if (!hasMCU && hasInitiated) { + } else if (!hasMCU && hasInitiated && "video".equals(this.videoStreamType)) { + // If the connection type is "screen" the client sharing the screen will send an + // offer; offers should be created only for videos. peerConnection.createOffer(magicSdpObserver, mediaConstraints); } }