Fix SDP constraints used by PeerConnectionWrapper

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 <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2024-12-23 18:40:06 +01:00 committed by Marcel Hibbe
parent 94257da123
commit f112e26d25
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -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,