正在显示
2 个修改的文件
包含
27 行增加
和
6 行删除
| @@ -3,7 +3,7 @@ package io.livekit.android.room | @@ -3,7 +3,7 @@ package io.livekit.android.room | ||
| 3 | import com.github.ajalt.timberkt.Timber | 3 | import com.github.ajalt.timberkt.Timber |
| 4 | import com.google.protobuf.util.JsonFormat | 4 | import com.google.protobuf.util.JsonFormat |
| 5 | import io.livekit.android.dagger.InjectionNames | 5 | import io.livekit.android.dagger.InjectionNames |
| 6 | -import io.livekit.android.room.track.Track | 6 | +import io.livekit.android.util.safe |
| 7 | import kotlinx.serialization.decodeFromString | 7 | import kotlinx.serialization.decodeFromString |
| 8 | import kotlinx.serialization.encodeToString | 8 | import kotlinx.serialization.encodeToString |
| 9 | import kotlinx.serialization.json.Json | 9 | import kotlinx.serialization.json.Json |
| @@ -182,7 +182,7 @@ constructor( | @@ -182,7 +182,7 @@ constructor( | ||
| 182 | 182 | ||
| 183 | fun sendUpdateTrackSettings(sid: String, disabled: Boolean, videoQuality: LivekitRtc.VideoQuality) { | 183 | fun sendUpdateTrackSettings(sid: String, disabled: Boolean, videoQuality: LivekitRtc.VideoQuality) { |
| 184 | val trackSettings = LivekitRtc.UpdateTrackSettings.newBuilder() | 184 | val trackSettings = LivekitRtc.UpdateTrackSettings.newBuilder() |
| 185 | - .setTrackSids(0, sid) | 185 | + .addTrackSids(sid) |
| 186 | .setDisabled(disabled) | 186 | .setDisabled(disabled) |
| 187 | .setQuality(videoQuality) | 187 | .setQuality(videoQuality) |
| 188 | 188 | ||
| @@ -195,7 +195,7 @@ constructor( | @@ -195,7 +195,7 @@ constructor( | ||
| 195 | 195 | ||
| 196 | fun sendUpdateSubscription(sid: String, subscribe: Boolean, videoQuality: LivekitRtc.VideoQuality) { | 196 | fun sendUpdateSubscription(sid: String, subscribe: Boolean, videoQuality: LivekitRtc.VideoQuality) { |
| 197 | val subscription = LivekitRtc.UpdateSubscription.newBuilder() | 197 | val subscription = LivekitRtc.UpdateSubscription.newBuilder() |
| 198 | - .setTrackSids(0, sid) | 198 | + .addTrackSids(sid) |
| 199 | .setSubscribe(subscribe) | 199 | .setSubscribe(subscribe) |
| 200 | .setQuality(videoQuality) | 200 | .setQuality(videoQuality) |
| 201 | 201 | ||
| @@ -267,11 +267,14 @@ constructor( | @@ -267,11 +267,14 @@ constructor( | ||
| 267 | LivekitRtc.SignalResponse.MessageCase.SPEAKER -> { | 267 | LivekitRtc.SignalResponse.MessageCase.SPEAKER -> { |
| 268 | listener?.onActiveSpeakersChanged(response.speaker.speakersList) | 268 | listener?.onActiveSpeakersChanged(response.speaker.speakersList) |
| 269 | } | 269 | } |
| 270 | - LivekitRtc.SignalResponse.MessageCase.MESSAGE_NOT_SET -> TODO() | ||
| 271 | - else -> { | ||
| 272 | - Timber.v { "unhandled response type: ${response.messageCase.name}" } | 270 | + LivekitRtc.SignalResponse.MessageCase.JOIN -> { |
| 271 | + Timber.d { "received unexpected extra join message?" } | ||
| 273 | } | 272 | } |
| 273 | + LivekitRtc.SignalResponse.MessageCase.MESSAGE_NOT_SET, | ||
| 274 | + null -> { | ||
| 275 | + Timber.v { "empty messageCase!" } | ||
| 274 | } | 276 | } |
| 277 | + }.safe() | ||
| 275 | } | 278 | } |
| 276 | 279 | ||
| 277 | fun close() { | 280 | fun close() { |
| 1 | +@file:Suppress("unused") | ||
| 2 | + | ||
| 3 | +package io.livekit.android.util | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Forces a when expression to be exhaustive only. | ||
| 7 | + */ | ||
| 8 | +internal fun Unit.safe() {} | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * Forces a when expression to be exhaustive only. | ||
| 12 | + */ | ||
| 13 | +internal fun Nothing?.safe() {} | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * Forces a when expression to be exhaustive only. | ||
| 17 | + */ | ||
| 18 | +internal fun Any?.safe() {} |
-
请 注册 或 登录 后发表评论