mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-17 21:38:29 +00:00
Fixed crash due to TextureView API not called from main thread
This commit is contained in:
parent
3ad6c6c8ed
commit
7fe554be3c
1 changed files with 7 additions and 1 deletions
|
|
@ -25,7 +25,9 @@ import android.graphics.Rect
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewOutlineProvider
|
import android.view.ViewOutlineProvider
|
||||||
|
import androidx.annotation.MainThread
|
||||||
import androidx.annotation.UiThread
|
import androidx.annotation.UiThread
|
||||||
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
import java.lang.NumberFormatException
|
import java.lang.NumberFormatException
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.mediastream.video.capture.CaptureTextureView
|
import org.linphone.mediastream.video.capture.CaptureTextureView
|
||||||
|
|
@ -86,11 +88,13 @@ class RoundCornersTextureView : CaptureTextureView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MainThread
|
||||||
fun setRadius(radius: Float) {
|
fun setRadius(radius: Float) {
|
||||||
mRadius = radius
|
mRadius = radius
|
||||||
setRoundCorners()
|
setRoundCorners()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MainThread
|
||||||
private fun setRoundCorners() {
|
private fun setRoundCorners() {
|
||||||
outlineProvider = object : ViewOutlineProvider() {
|
outlineProvider = object : ViewOutlineProvider() {
|
||||||
override fun getOutline(view: View, outline: Outline) {
|
override fun getOutline(view: View, outline: Outline) {
|
||||||
|
|
@ -123,7 +127,9 @@ class RoundCornersTextureView : CaptureTextureView {
|
||||||
|
|
||||||
val previewSize = previewVideoSize
|
val previewSize = previewVideoSize
|
||||||
if (previewSize.width > 0 && previewSize.height > 0) {
|
if (previewSize.width > 0 && previewSize.height > 0) {
|
||||||
|
coreContext.postOnMainThread {
|
||||||
setRoundCorners()
|
setRoundCorners()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue