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
davidliu
2023-11-14 12:49:29 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-11-14 12:49:29 +0900
Commit
627ccca7ffb53f2cca2a7e540dbf06921b7f754e
627ccca7
1 parent
0a07a9b6
Schedule PeerConnection dispose to avoid race conditions (#316)
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
15 行增加
和
1 行删除
livekit-android-sdk/src/main/java/io/livekit/android/room/PeerConnectionTransport.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/RTCEngine.kt
livekit-android-sdk/src/main/java/io/livekit/android/room/PeerConnectionTransport.kt
查看文件 @
627ccca
...
...
@@ -36,7 +36,10 @@ import io.livekit.android.webrtc.getRtps
import io.livekit.android.webrtc.isConnected
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import org.webrtc.*
...
...
@@ -263,7 +266,14 @@ constructor(
suspend fun close() {
withNotClosedLock {
isClosed.set(true)
peerConnection.dispose()
peerConnection.close()
// Really ugly stop gap measure to avoid race conditions
// TODO: Properly lock any PeerConnection resources to prevent usage.
GlobalScope.launch {
delay(10L * 1000)
peerConnection.dispose()
}
}
}
...
...
livekit-android-sdk/src/main/java/io/livekit/android/room/RTCEngine.kt
查看文件 @
627ccca
...
...
@@ -363,6 +363,7 @@ internal constructor(
val reconnectStartTime = SystemClock.elapsedRealtime()
for (retries in 0 until MAX_RECONNECT_RETRIES) {
ensureActive()
if (retries != 0) {
yield()
}
...
...
@@ -427,6 +428,7 @@ internal constructor(
}
}
ensureActive()
if (isClosed) {
LKLog.v { "RTCEngine closed, aborting reconnection" }
break
...
...
@@ -444,6 +446,7 @@ internal constructor(
}
}
ensureActive()
if (isClosed) {
LKLog.v { "RTCEngine closed, aborting reconnection" }
break
...
...
@@ -458,6 +461,7 @@ internal constructor(
delay(100)
}
ensureActive()
if (isClosed) {
LKLog.v { "RTCEngine closed, aborting reconnection" }
break
...
...
请
注册
或
登录
后发表评论