From f112e26d251fb80657c9af43f300b04bc8e612f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Mon, 23 Dec 2024 18:40:06 +0100 Subject: [PATCH] Fix SDP constraints used by PeerConnectionWrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDP constraints for publisher connections when the MCU is used were set for all connections. Those constraints set "OfferToReceiveAudio" and "OfferToReceiveVideo" to false, which disables receiving audio and video when the local participant is the one sending the offer. Therefore, audio and video was not received when the MCU was not used and the local participant was the one initiating the connection. The "OfferToReceiveXXX" configurations have no effect when set on an answer (and thus are not even set, an empty MediaConstraints is used in that case). However, when "OfferToReceiveVideo = false" is set the video transceiver is explicitly stopped (which is used to avoid receiving video when joining a call with audio only). Therefore, as "OfferToReceiveVideo = false" was always set, video was never received in subscriber connections when the MCU is used, or connections initiated by the other peer when the MCU is not used. Signed-off-by: Daniel Calviño Sánchez --- .../main/java/com/nextcloud/talk/activities/CallActivity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index ac5259bdd..84a746225 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -2350,18 +2350,22 @@ class CallActivity : CallBaseActivity() { sessionId: String?, type: String ): PeerConnectionWrapper { + val tempSdpConstraints: MediaConstraints? val tempIsMCUPublisher: Boolean val tempHasMCU: Boolean val tempLocalStream: MediaStream? if (hasMCU && publisher) { + tempSdpConstraints = sdpConstraintsForMCUPublisher tempIsMCUPublisher = true tempHasMCU = true tempLocalStream = localStream } else if (hasMCU) { + tempSdpConstraints = sdpConstraints tempIsMCUPublisher = false tempHasMCU = true tempLocalStream = null } else { + tempSdpConstraints = sdpConstraints tempIsMCUPublisher = false tempHasMCU = false tempLocalStream = if ("screen" != type) { @@ -2374,7 +2378,7 @@ class CallActivity : CallBaseActivity() { return PeerConnectionWrapper( peerConnectionFactory, iceServers, - sdpConstraintsForMCUPublisher, + tempSdpConstraints, sessionId, callSession, tempLocalStream,