Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tricky-grapes-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"client-sdk-android": patch
---

Fix custom RTCConfigurations not picking up server-provided ice servers when user-provided list is empty
Original file line number Diff line number Diff line change
Expand Up @@ -998,14 +998,13 @@ internal constructor(

// Only use server-provided servers if user doesn't provide any.
if (mergedServers.isEmpty()) {
iceServers.forEach { server ->
if (!mergedServers.contains(server)) {
mergedServers.add(server)
}
}
mergedServers.addAll(serverIceServers)
}

iceServers = mergedServers
sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN
continualGatheringPolicy =
PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY
}
?: RTCConfiguration(serverIceServers).apply {
sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.livekit.android.room

import com.google.protobuf.ByteString
import io.livekit.android.ConnectOptions
import io.livekit.android.room.track.TrackException
import io.livekit.android.test.MockE2ETest
import io.livekit.android.test.events.FlowCollector
Expand Down Expand Up @@ -84,6 +85,38 @@ class RTCEngineMockE2ETest : MockE2ETest() {
assertEquals(sentIceServers, subPeerConnection.rtcConfig.iceServers)
}

@Test
fun customRtcConfigWithEmptyIceServersUsesServerIceServers() = runTest {
val connectJob = async {
room.connect(
url = TestData.EXAMPLE_URL,
token = "token",
options = ConnectOptions(
rtcConfig = PeerConnection.RTCConfiguration(emptyList()).apply {
iceTransportsType = PeerConnection.IceTransportsType.RELAY
},
),
)
}
prepareSignal(TestData.JOIN)
connectJob.await()
connectPeerConnection()

val subPeerConnection = getSubscriberPeerConnection()
assertEquals(PeerConnection.IceTransportsType.RELAY, subPeerConnection.rtcConfig.iceTransportsType)
val sentIceServers = TestData.JOIN.join.iceServersList
.map { it.toWebrtc() }
assertEquals(sentIceServers, subPeerConnection.rtcConfig.iceServers)
assertEquals(
PeerConnection.SdpSemantics.UNIFIED_PLAN,
subPeerConnection.rtcConfig.sdpSemantics,
)
assertEquals(
PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY,
subPeerConnection.rtcConfig.continualGatheringPolicy,
)
}

@Test
fun roomConnectDoesNotHangOnWebSocketFailure() = runTest {
val connectJob = async {
Expand Down
Loading