Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
livekitAndroidXuningTest
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David Zhao
2021-04-16 13:39:53 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7efe1f17bd87de10597d86e9ffaf2067376ebb9f
7efe1f17
1 parent
ac2bc43a
supports packed streamId, protocol 1
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
19 行增加
和
8 行删除
livekit-android-sdk/src/main/java/io/livekit/android/room/RTCClient.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/Room.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/RTCClient.kt
查看文件 @
7efe1f1
...
...
@@ -34,7 +34,6 @@ constructor(
@Named(InjectionNames.SIGNAL_JSON_ENABLED)
private val useJson: Boolean,
) : WebSocketListener() {
var isConnected = false
private set
private var currentWs: WebSocket? = null
...
...
@@ -44,7 +43,7 @@ constructor(
url: String,
token: String,
) {
val wsUrlString = "$url/rtc?access_token=$token"
val wsUrlString = "$url/rtc?access_token=$token
&protocol=$PROTOCOL_VERSION
"
Timber.i { "connecting to $wsUrlString" }
val request = Request.Builder()
...
...
@@ -304,16 +303,18 @@ constructor(
const val SD_TYPE_ANSWER = "answer"
const val SD_TYPE_OFFER = "offer"
const val SD_TYPE_PRANSWER = "pranswer"
const val PROTOCOL_VERSION = 1;
private fun iceServer(url: String) =
PeerConnection.IceServer.builder(url).createIceServer()
// more stun servers might slow it down, WebRTC recommends 3 max
val DEFAULT_ICE_SERVERS = listOf(
iceServer("stun:stun.l.google.com:19302"),
iceServer("stun:stun1.l.google.com:19302"),
iceServer("stun:stun2.l.google.com:19302"),
iceServer("stun:stun3.l.google.com:19302"),
iceServer("stun:stun4.l.google.com:19302"),
// iceServer("stun:stun2.l.google.com:19302"),
// iceServer("stun:stun3.l.google.com:19302"),
// iceServer("stun:stun4.l.google.com:19302"),
)
}
}
\ No newline at end of file
...
...
livekit-android-sdk/src/main/java/io/livekit/android/room/Room.kt
查看文件 @
7efe1f1
...
...
@@ -202,10 +202,12 @@ constructor(
return
}
val participantSid = streams.first().id
val trackSid = track.id()
var (participantSid, trackSid) = unpackStreamId(streams.first().id)
if (trackSid == null) {
trackSid = track.id()
}
val participant = getOrCreateRemoteParticipant(participantSid)
participant.addSubscribedMediaTrack(track, trackSid)
participant.addSubscribedMediaTrack(track, trackSid
!!
)
}
/**
...
...
@@ -447,3 +449,11 @@ sealed class RoomException(message: String? = null, cause: Throwable? = null) :
class ConnectException(message: String? = null, cause: Throwable? = null) :
RoomException(message, cause)
}
internal fun unpackStreamId(packed: String): Pair<String, String?> {
val parts = packed.split('|')
if (parts.size != 2) {
return Pair(packed, null)
}
return Pair(parts[0], parts[1])
}
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论