From 54a9f1b40d0212eecba78117a812a5e59b0a6550 Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 26 Oct 2023 14:55:08 +0200 Subject: [PATCH] ignore runtime error on updatetextimage --- .../encoder/input/gl/render/CameraRender.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/encoder/src/main/java/com/pedro/encoder/input/gl/render/CameraRender.java b/encoder/src/main/java/com/pedro/encoder/input/gl/render/CameraRender.java index 41924f85f..037944d33 100644 --- a/encoder/src/main/java/com/pedro/encoder/input/gl/render/CameraRender.java +++ b/encoder/src/main/java/com/pedro/encoder/input/gl/render/CameraRender.java @@ -22,6 +22,7 @@ import android.opengl.GLES20; import android.opengl.Matrix; import android.os.Build; +import android.util.Log; import android.view.Surface; import androidx.annotation.RequiresApi; @@ -40,9 +41,11 @@ @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2) public class CameraRender extends BaseRenderOffScreen { - private int[] textureID = new int[1]; - private float[] rotationMatrix = new float[16]; - private float[] scaleMatrix = new float[16]; + private final String TAG = "CameraRender"; + + private final int[] textureID = new int[1]; + private final float[] rotationMatrix = new float[16]; + private final float[] scaleMatrix = new float[16]; private int program = -1; private int uMVPMatrixHandle = -1; @@ -131,7 +134,12 @@ public void release() { } public void updateTexImage() { - surfaceTexture.updateTexImage(); + try { + //runtime error could be ignored + surfaceTexture.updateTexImage(); + } catch (RuntimeException e) { + Log.e(TAG, "error", e); + } } public SurfaceTexture getSurfaceTexture() {