davidliu
Committed by GitHub

Fix crash when setting publishing layers (#559)

---
"client-sdk-android": patch
---
Fix crash when setting publishing layers
... ...
... ... @@ -316,6 +316,11 @@ constructor(
sender: RtpSender,
qualities: List<LivekitRtc.SubscribedQuality>,
) {
if (isDisposed) {
LKLog.i { "attempted to set publishing layer for disposed video track." }
return
}
try {
val parameters = sender.parameters ?: return
val encodings = parameters.encodings ?: return
var hasChanged = false
... ... @@ -357,8 +362,12 @@ constructor(
}
if (hasChanged) {
// This refeshes the native code with the new information
sender.parameters = sender.parameters
// This refreshes the native code with the new information
sender.parameters = parameters
}
} catch (e: Exception) {
LKLog.w(e) { "Exception caught while setting publishing layers." }
return
}
}
... ...