Committed by
GitHub
Fix crash when setting publishing layers (#559)
正在显示
2 个修改的文件
包含
16 行增加
和
2 行删除
.changeset/eleven-schools-flash.md
0 → 100644
| @@ -316,6 +316,11 @@ constructor( | @@ -316,6 +316,11 @@ constructor( | ||
| 316 | sender: RtpSender, | 316 | sender: RtpSender, |
| 317 | qualities: List<LivekitRtc.SubscribedQuality>, | 317 | qualities: List<LivekitRtc.SubscribedQuality>, |
| 318 | ) { | 318 | ) { |
| 319 | + if (isDisposed) { | ||
| 320 | + LKLog.i { "attempted to set publishing layer for disposed video track." } | ||
| 321 | + return | ||
| 322 | + } | ||
| 323 | + try { | ||
| 319 | val parameters = sender.parameters ?: return | 324 | val parameters = sender.parameters ?: return |
| 320 | val encodings = parameters.encodings ?: return | 325 | val encodings = parameters.encodings ?: return |
| 321 | var hasChanged = false | 326 | var hasChanged = false |
| @@ -357,8 +362,12 @@ constructor( | @@ -357,8 +362,12 @@ constructor( | ||
| 357 | } | 362 | } |
| 358 | 363 | ||
| 359 | if (hasChanged) { | 364 | if (hasChanged) { |
| 360 | - // This refeshes the native code with the new information | ||
| 361 | - sender.parameters = sender.parameters | 365 | + // This refreshes the native code with the new information |
| 366 | + sender.parameters = parameters | ||
| 367 | + } | ||
| 368 | + } catch (e: Exception) { | ||
| 369 | + LKLog.w(e) { "Exception caught while setting publishing layers." } | ||
| 370 | + return | ||
| 362 | } | 371 | } |
| 363 | } | 372 | } |
| 364 | 373 |
-
请 注册 或 登录 后发表评论