正在显示
3 个修改的文件
包含
2 行增加
和
11 行删除
| @@ -13,11 +13,7 @@ class PublisherTransportObserver( | @@ -13,11 +13,7 @@ class PublisherTransportObserver( | ||
| 13 | 13 | ||
| 14 | override fun onIceCandidate(iceCandidate: IceCandidate?) { | 14 | override fun onIceCandidate(iceCandidate: IceCandidate?) { |
| 15 | val candidate = iceCandidate ?: return | 15 | val candidate = iceCandidate ?: return |
| 16 | - if (engine.rtcConnected) { | ||
| 17 | engine.client.sendCandidate(candidate, target = LivekitRtc.SignalTarget.PUBLISHER) | 16 | engine.client.sendCandidate(candidate, target = LivekitRtc.SignalTarget.PUBLISHER) |
| 18 | - } else { | ||
| 19 | - engine.pendingCandidates.add(candidate) | ||
| 20 | - } | ||
| 21 | } | 17 | } |
| 22 | 18 | ||
| 23 | override fun onRenegotiationNeeded() { | 19 | override fun onRenegotiationNeeded() { |
| @@ -43,7 +43,6 @@ constructor( | @@ -43,7 +43,6 @@ constructor( | ||
| 43 | joinResponse = null | 43 | joinResponse = null |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | - val pendingCandidates = mutableListOf<IceCandidate>() | ||
| 47 | private val pendingTrackResolvers: MutableMap<String, Continuation<LivekitModels.TrackInfo>> = | 46 | private val pendingTrackResolvers: MutableMap<String, Continuation<LivekitModels.TrackInfo>> = |
| 48 | mutableMapOf() | 47 | mutableMapOf() |
| 49 | 48 | ||
| @@ -85,7 +84,6 @@ constructor( | @@ -85,7 +84,6 @@ constructor( | ||
| 85 | } | 84 | } |
| 86 | 85 | ||
| 87 | fun negotiate() { | 86 | fun negotiate() { |
| 88 | - | ||
| 89 | if (!client.isConnected) { | 87 | if (!client.isConnected) { |
| 90 | return | 88 | return |
| 91 | } | 89 | } |
| @@ -114,10 +112,6 @@ constructor( | @@ -114,10 +112,6 @@ constructor( | ||
| 114 | private fun onRTCConnected() { | 112 | private fun onRTCConnected() { |
| 115 | Timber.v { "RTC Connected" } | 113 | Timber.v { "RTC Connected" } |
| 116 | rtcConnected = true | 114 | rtcConnected = true |
| 117 | - pendingCandidates.forEach { candidate -> | ||
| 118 | - client.sendCandidate(candidate, LivekitRtc.SignalTarget.PUBLISHER) | ||
| 119 | - } | ||
| 120 | - pendingCandidates.clear() | ||
| 121 | } | 115 | } |
| 122 | 116 | ||
| 123 | interface Listener { | 117 | interface Listener { |
| @@ -204,6 +198,7 @@ constructor( | @@ -204,6 +198,7 @@ constructor( | ||
| 204 | when (val outcome = publisher.peerConnection.setLocalDescription(sdpOffer)) { | 198 | when (val outcome = publisher.peerConnection.setLocalDescription(sdpOffer)) { |
| 205 | is Either.Right -> { | 199 | is Either.Right -> { |
| 206 | Timber.d { "error setting local description: ${outcome.value}" } | 200 | Timber.d { "error setting local description: ${outcome.value}" } |
| 201 | + return@launch | ||
| 207 | } | 202 | } |
| 208 | } | 203 | } |
| 209 | 204 |
| @@ -152,7 +152,6 @@ constructor( | @@ -152,7 +152,6 @@ constructor( | ||
| 152 | override fun onJoin(response: LivekitRtc.JoinResponse) { | 152 | override fun onJoin(response: LivekitRtc.JoinResponse) { |
| 153 | Timber.v { "engine did join, version: ${response.serverVersion}" } | 153 | Timber.v { "engine did join, version: ${response.serverVersion}" } |
| 154 | 154 | ||
| 155 | - state = State.CONNECTED | ||
| 156 | sid = Sid(response.room.sid) | 155 | sid = Sid(response.room.sid) |
| 157 | name = response.room.name | 156 | name = response.room.name |
| 158 | 157 | ||
| @@ -170,6 +169,7 @@ constructor( | @@ -170,6 +169,7 @@ constructor( | ||
| 170 | } | 169 | } |
| 171 | } | 170 | } |
| 172 | 171 | ||
| 172 | + state = State.CONNECTED | ||
| 173 | connectContinuation?.resume(Unit) | 173 | connectContinuation?.resume(Unit) |
| 174 | connectContinuation = null | 174 | connectContinuation = null |
| 175 | } | 175 | } |
-
请 注册 或 登录 后发表评论