Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got drawCamera start. GL error: 1281 after version 2.5.8 #1785

Open
danielhergil opened this issue Mar 29, 2025 · 22 comments
Open

Got drawCamera start. GL error: 1281 after version 2.5.8 #1785

danielhergil opened this issue Mar 29, 2025 · 22 comments

Comments

@danielhergil
Copy link

danielhergil commented Mar 29, 2025

Hi there! I am having a crash when I start the camera render in my SurfaceView after 2.5.8 version. I think the error may when the camera is trying to start with bad parameter even that the parameters are set before starting.

The commit that worked for me was
8fdb283

But I thing after this other change
1c5482d
it crashes in my app.

I wanted to know if I can do something in my app to solve this. The error log is this:

Fatal Exception: java.lang.RuntimeException: drawCamera start. GL error: 1281
       at com.pedro.encoder.utils.gl.GlUtil.checkGlError(GlUtil.java:132)
       at com.pedro.encoder.input.gl.render.CameraRender.draw(CameraRender.java:99)
       at com.pedro.encoder.input.gl.render.MainRender.drawOffScreen(MainRender.kt:61)
       at com.pedro.library.view.GlStreamInterface.draw(GlStreamInterface.kt:270)
       at com.pedro.library.view.GlStreamInterface.onFrameAvailable$lambda$4(GlStreamInterface.kt:284)
       at com.pedro.library.view.GlStreamInterface.$r8$lambda$0B-KT4vcqgQlJR7AIT7c70zbmo0()
       at com.pedro.library.view.GlStreamInterface$$ExternalSyntheticLambda3.run(D8$$SyntheticClass)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:920)

If helps, this is my SurfaceView:

AndroidView(
        factory = { ctx ->
            SurfaceView(ctx).apply {


                layoutParams = ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT
                )
                surfaceViewRef.value = this

                holder.setFormat(PixelFormat.TRANSLUCENT)

                holder.addCallback(object : SurfaceHolder.Callback {
                    override fun surfaceCreated(holder: SurfaceHolder) {
                        if (!genericStream.isOnPreview) {
                            genericStream.startPreview(this@apply)
                        }
                    }
                    override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
                        genericStream.getGlInterface().setPreviewResolution(width, height)
                    }
                    override fun surfaceDestroyed(holder: SurfaceHolder) {
                        if (genericStream.isOnPreview) {
                            genericStream.stopPreview()
                        }
                    }
                })
            }
        },
        modifier = Modifier.fillMaxSize()
    )

This is how I instantiate generic stream:

val genericStream = remember {
        GenericStream(context, object : ConnectChecker {
            override fun onConnectionStarted(url: String) {}
            override fun onConnectionSuccess() { showToast("Connected") }
            override fun onConnectionFailed(reason: String) { showToast("Connection failed: $reason") }
            override fun onNewBitrate(bitrate: Long) {}
            override fun onDisconnect() { showToast("Disconnected") }
            override fun onAuthError() { showToast("Authentication error") }
            override fun onAuthSuccess() { showToast("Authentication success") }
        }, activeCameraSource, audio).apply {
            prepareVideo(videoWidth, videoHeight, videoBitrate, videoFPS)
            prepareAudio(audioSampleRate, audioIsStereo, audioBitrate)
            setTimestampMode(TimestampMode.CLOCK, TimestampMode.BUFFER)
            getGlInterface().autoHandleOrientation = true
        }
    }

I wanted to have the library updated for the new features and upgrades! Thank you so much

@pedroSG94
Copy link
Owner

Hello,

Try with this commit:

  implementation 'com.github.pedroSG94.RootEncoder:library:9680da7936'
  //Optional, allow use CameraXSource and CameraUvcSource 
  implementation 'com.github.pedroSG94.RootEncoder:extra-sources:9680da7936'

If this solve the problem, I have plan to update a version after fix other issues reported

@danielhergil
Copy link
Author

danielhergil commented Mar 29, 2025

Hello! I have tested the commit, but still crashing with the same error:


at com.pedro.encoder.utils.gl.GlUtil.checkGlError(GlUtil.java:132)
at com.pedro.encoder.input.gl.render.CameraRender.draw(CameraRender.java:99)
at com.pedro.encoder.input.gl.render.MainRender.drawOffScreen(MainRender.kt:61)
at com.pedro.library.view.GlStreamInterface.draw(GlStreamInterface.kt:283)
at com.pedro.library.view.GlStreamInterface.onFrameAvailable$lambda$12(GlStreamInterface.kt:297)
at com.pedro.library.view.GlStreamInterface.$r8$lambda$a1ENDcGT4iUZBm7t0BOaCXqDyvY(Unknown Source:0)
at com.pedro.library.view.GlStreamInterface$$ExternalSyntheticLambda4.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)
eglMakeCurrentImpl:1067 error 3002 (EGL_BAD_ACCESS)
eglMakeCurrent failed
[SurfaceTexture-1-18650-1] checkAndUpdateEglState: invalid current EGLDisplay
at android.graphics.SurfaceTexture.nativeUpdateTexImage(Native Method)
at android.graphics.SurfaceTexture.updateTexImage(SurfaceTexture.java:249)
at com.pedro.encoder.input.gl.render.CameraRender.updateTexImage(CameraRender.java:139)
at com.pedro.encoder.input.gl.render.MainRender.updateFrame(MainRender.kt:173)
at com.pedro.library.view.GlStreamInterface.draw(GlStreamInterface.kt:225)
at com.pedro.library.view.GlStreamInterface.onFrameAvailable$lambda$12(GlStreamInterface.kt:297)
at com.pedro.library.view.GlStreamInterface.$r8$lambda$a1ENDcGT4iUZBm7t0BOaCXqDyvY(Unknown Source:0)
at com.pedro.library.view.GlStreamInterface$$ExternalSyntheticLambda4.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)

@pedroSG94
Copy link
Owner

Try again with this:

  implementation 'com.github.pedroSG94.RootEncoder:library:08bd3b690c'
  //Optional, allow use CameraXSource and CameraUvcSource 
  implementation 'com.github.pedroSG94.RootEncoder:extra-sources:08bd3b690c'

I'm doing this because I'm not able to reproduce the problem. Maybe a class with full code example or a demo project in github could help me to reproduce it.

@danielhergil
Copy link
Author

Hello, the error still the same with the difference that the logs DO NOT show the second error:

at android.graphics.SurfaceTexture.nativeUpdateTexImage(Native Method)
at android.graphics.SurfaceTexture.updateTexImage(SurfaceTexture.java:249)
at com.pedro.encoder.input.gl.render.CameraRender.updateTexImage(CameraRender.java:139)
at com.pedro.encoder.input.gl.render.MainRender.updateFrame(MainRender.kt:173)
at com.pedro.library.view.GlStreamInterface.draw(GlStreamInterface.kt:225)
at com.pedro.library.view.GlStreamInterface.onFrameAvailable$lambda$12(GlStreamInterface.kt:297)
at com.pedro.library.view.GlStreamInterface.$r8$lambda$a1ENDcGT4iUZBm7t0BOaCXqDyvY(Unknown Source:0)
at com.pedro.library.view.GlStreamInterface$$ExternalSyntheticLambda4.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)

Do not worry, I will test 10.000 times if necessary. This is the file I have all the core: https://github.com/danielhergil/calypso-app/blob/main/app/src/main/java/com/danihg/calypsoapp/presentation/camera/CameraScreen.kt

The branch that contains the problems that i am testing for the library upgrade is new-version-crash. Feel free to clone and debug what you need,

Thank you so much!!

@danielhergil
Copy link
Author

Hello,

now it returns this error. It does not crash, but the screen is black:

java.lang.NullPointerException: getSurfaceTexture(...) must not be null
at com.pedro.encoder.input.gl.render.MainRender.getSurfaceTexture(MainRender.kt:176)
at com.pedro.library.view.GlStreamInterface.getSurfaceTexture(GlStreamInterface.kt:131)
at com.pedro.library.base.StreamBase.startPreview(StreamBase.kt:368)
at com.pedro.library.base.StreamBase.startPreview(StreamBase.kt:346)
at com.pedro.library.base.StreamBase.startPreview$default(StreamBase.kt:328)
at com.danihg.calypsoapp.presentation.camera.CameraScreenKt$CameraPreview$1$1$1.surfaceCreated(CameraScreen.kt:1536)
at android.view.SurfaceView.updateSurface(SurfaceView.java:1350)
at android.view.SurfaceView.lambda$new$1$SurfaceView(SurfaceView.java:254)
at android.view.SurfaceView$$ExternalSyntheticLambda2.onPreDraw(Unknown Source:2)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1112)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4189)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2911)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10458)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1108)
at android.view.Choreographer.doCallbacks(Choreographer.java:866)
at android.view.Choreographer.doFrame(Choreographer.java:797)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

@pedroSG94
Copy link
Owner

Yes, my bad. This is the commit:

  implementation 'com.github.pedroSG94.RootEncoder:library:a2f2032b1c'
  //Optional, allow use CameraXSource and CameraUvcSource 
  implementation 'com.github.pedroSG94.RootEncoder:extra-sources:a2f2032b1c'

@danielhergil
Copy link
Author

danielhergil commented Mar 30, 2025

That commit returns this log:

java.lang.RuntimeException: drawCamera start. GL error: 1281
at com.pedro.encoder.utils.gl.GlUtil.checkGlError(GlUtil.java:132)
at com.pedro.encoder.input.gl.render.CameraRender.handleDraw(CameraRender.java:106)
at com.pedro.encoder.input.gl.render.CameraRender.drawPreview(CameraRender.java:102)
at com.pedro.encoder.input.gl.render.MainRender.drawOffScreen(MainRender.kt:60)
at com.pedro.library.view.GlStreamInterface.draw(GlStreamInterface.kt:287)
at com.pedro.library.view.GlStreamInterface.onFrameAvailable$lambda$9(GlStreamInterface.kt:303)
at com.pedro.library.view.GlStreamInterface.$r8$lambda$BAtYl6ZVCZbXX960JSr5g3IQUyw(Unknown Source:0)
at com.pedro.library.view.GlStreamInterface$$ExternalSyntheticLambda2.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)

E  eglMakeCurrentImpl:1067 error 3002 (EGL_BAD_ACCESS)
E  eglMakeCurrent failed
E  eglMakeCurrentImpl:1067 error 3002 (EGL_BAD_ACCESS)
E  eglMakeCurrent failed

I think it points to a different places than previously.

@pedroSG94
Copy link
Owner

Hello,

Try with this commit:

  implementation 'com.github.pedroSG94.RootEncoder:library:d35f99957b'
  //Optional, allow use CameraXSource and CameraUvcSource 
  implementation 'com.github.pedroSG94.RootEncoder:extra-sources:d35f99957b'

I know that the error is related with this:
https://github.com/pedroSG94/RootEncoder/blob/master/library/src/main/java/com/pedro/library/view/GlStreamInterface.kt#L268

But I don't know the reason because it is wokring in fews devices and fail in others

@danielhergil
Copy link
Author

That commit returns this log:

java.lang.RuntimeException: drawCamera start. GL error: 1281
at com.pedro.encoder.utils.gl.GlUtil.checkGlError(GlUtil.java:132)
at com.pedro.encoder.input.gl.render.CameraRender.handleDraw(CameraRender.java:106)
at com.pedro.encoder.input.gl.render.CameraRender.drawPreview(CameraRender.java:102)
at com.pedro.encoder.input.gl.render.MainRender.drawOffScreen(MainRender.kt:60)
at com.pedro.library.view.GlStreamInterface.draw(GlStreamInterface.kt:287)
at com.pedro.library.view.GlStreamInterface.onFrameAvailable$lambda$9(GlStreamInterface.kt:303)
at com.pedro.library.view.GlStreamInterface.$r8$lambda$BAtYl6ZVCZbXX960JSr5g3IQUyw(Unknown Source:0)
at com.pedro.library.view.GlStreamInterface$$ExternalSyntheticLambda2.run(D8$$SyntheticClass:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)

E  eglMakeCurrentImpl:1067 error 3002 (EGL_BAD_ACCESS)
E  eglMakeCurrent failed
E  eglMakeCurrentImpl:1067 error 3002 (EGL_BAD_ACCESS)
E  eglMakeCurrent failed

I think it points to a different places than previously.

It is giving the same error with this commit. Yes I think the same, after the versión 2.5.7 probably some devices are not handling well. Whatever I can do to help with this, I am happy to do it.

@pedroSG94
Copy link
Owner

  implementation 'com.github.pedroSG94.RootEncoder:library:d984eaaaaa'
  //Optional, allow use CameraXSource and CameraUvcSource 
  implementation 'com.github.pedroSG94.RootEncoder:extra-sources:d984eaaaaa'

The commit remove the code that produce the error, It is only to comfirm 100% that the error is related with that code.

@danielhergil
Copy link
Author

Confirmed, that commit is not crashing anything. The camera is rendered perfeclty.

@pedroSG94
Copy link
Owner

Hello,

Try this commit:

  implementation 'com.github.pedroSG94.RootEncoder:library:e850eb2fc9'
  //Optional, allow use CameraXSource and CameraUvcSource 
  implementation 'com.github.pedroSG94.RootEncoder:extra-sources:e850eb2fc9'

This commit change the way filters works, if it is working, the feature that failed can be replaced by a filter.
Test if it is working without filters and add a filter to confirm that it is working with filters.

@danielhergil
Copy link
Author

Hello,

That commit seems to work fine, but I have seen something that didnt happen before. First, something that was a huge improve it is how the filters are drawing in the camera. Before this, it was like a screen refresh that you could see in your screen but also in the stream broadcast, now the filter draw is smooth and you dont notice anything in the screen.

But, for example I have this filter that is drawing line by line, the team players of two teams, with a delay of 1 second between rows.

fun TeamPlayersOverlay(
    visible: Boolean,
    genericStream: GenericStream,
    screenWidth: Int,
    screenHeight: Int,
    team1Name: String,
    team2Name: String,
    team1Players: List<PlayerEntry>,
    team2Players: List<PlayerEntry>,
    leftLogo: Bitmap,
    rightLogo: Bitmap,
    selectedTeamsOverlayDuration: String,
    lineUpFilter: ImageObjectFilterRender,
    context: Context,
    onLineUpFinished: () -> Unit
){
    // Add or remove the overlay filter based on visibility.
    LaunchedEffect(visible) {
        if (visible && genericStream.isOnPreview) {
            genericStream.getGlInterface().clearFilters()
            genericStream.getGlInterface().addFilter(lineUpFilter)
        } else {
            genericStream.getGlInterface().removeFilter(lineUpFilter)
        }

        if (visible && genericStream.isOnPreview) {
            drawTeamPlayersOverlay(
                context = context,
                screenWidth = screenWidth,
                screenHeight = screenHeight,
                leftLogoBitmap = leftLogo,
                rightLogoBitmap = rightLogo,
                leftTeamName = team1Name,
                rightTeamName = team2Name,
                leftTeamPlayers = team1Players,
                rightTeamPlayers = team2Players,
                imageObjectFilterRender = lineUpFilter,
                isOnPreview = genericStream.isOnPreview
            )

            val teamPlayersOverlayDelay = selectedTeamsOverlayDuration.split("s").first()
            delay(teamPlayersOverlayDelay.toLong() * 1000)
            genericStream.getGlInterface().removeFilter(lineUpFilter)
            onLineUpFinished()
        }
    }
}

This is how I call it in the app:

TeamPlayersOverlay(
    visible = showLineUpOverlay && !showTeamPlayersOverlayMenu,
    genericStream = genericStream,
    screenWidth = LocalContext.current.resources.displayMetrics.widthPixels,
    screenHeight = LocalContext.current.resources.displayMetrics.heightPixels,
    team1Name = selectedTeam1,
    team2Name = selectedTeam2,
    team1Players = team1Players,
    team2Players = team2Players,
    leftLogo = finalLeftLogo,
    rightLogo = finalRightLogo,
    selectedTeamsOverlayDuration = selectedTeamsOverlayDuration,
    lineUpFilter = lineUpFilter,
    context = context,
    onLineUpFinished = {
        showLineUpOverlay = false
        if (wasScoreboardActive) {
            CoroutineScope(Dispatchers.Main).launch {
                genericStream.getGlInterface().clearFilters()
                showScoreboardOverlay = false
                delay(50)
                showScoreboardOverlay = true
            }
        }
    }
)

Before, I could activate the filter any number of times, but now, after the first time that is drawing perfect, the second time and further are doing weird things, like drawing upside down puting the camera in black, or like double rendering. I dont know if this could be because genericStream.getGlInterface().removeFilter(lineUpFilter) at the end of the filter function.

I dont know if I explained it clearly but it is difficult to describe the behave after the second try drawing the filter. But anyways I have another filter (a scoreboard) that I can draw, remove, draw, remove, and repeat any time that it renders without problem, so maybe it could be something that I have to change in my filter instead, I just comment it because previously it didnt happen. I can share the filter itself if it could be interesting: https://github.com/danielhergil/calypso-app/blob/main/app/src/main/java/com/danihg/calypsoapp/overlays/TeamPlayersOverlay2.kt

@pedroSG94
Copy link
Owner

Hello,

I will check it. The way filters are renderer changed so it is possible

@danielhergil
Copy link
Author

Hello,

I have solved the problem I had with my filter by modifying the logic of my filter, that now is working. But I have been testing more the filters, changing, active one, then another and I have found that when I change filters, in my case, I active the scoreboard filter and then I change to the lin up filter, it returns this error with an app crash:

java.lang.RuntimeException: drawFilter start. GL error: 1282
	at com.pedro.encoder.utils.gl.GlUtil.checkGlError(GlUtil.java:132)
	at com.pedro.encoder.input.gl.render.filters.BaseFilterRender.draw(BaseFilterRender.java:69)
	at com.pedro.encoder.input.gl.render.MainRender.drawFilters(MainRender.kt:68)
	at com.pedro.library.view.GlStreamInterface.draw(GlStreamInterface.kt:240)
	at com.pedro.library.view.GlStreamInterface.onFrameAvailable$lambda$4(GlStreamInterface.kt:292)
	at com.pedro.library.view.GlStreamInterface.$r8$lambda$0B-KT4vcqgQlJR7AIT7c70zbmo0(Unknown Source:0)
	at com.pedro.library.view.GlStreamInterface$$ExternalSyntheticLambda5.run(D8$$SyntheticClass:0)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:920)
eglMakeCurrentImpl:1067 error 3002 (EGL_BAD_ACCESS)
eglMakeCurrent failed
eglMakeCurrentImpl:1067 error 3002 (EGL_BAD_ACCESS)
eglMakeCurrent failed

In my case, if I have the scoreboard filter that is an ImageObjectFilterRender and then I turn on the line up filter that is this one:

fun TeamPlayersOverlay(
    visible: Boolean,
    genericStream: GenericStream,
    screenWidth: Int,
    screenHeight: Int,
    team1Name: String,
    team2Name: String,
    team1Players: List<PlayerEntry>,
    team2Players: List<PlayerEntry>,
    leftLogo: Bitmap,
    rightLogo: Bitmap,
    selectedTeamsOverlayDuration: String,
    lineUpFilter: ImageObjectFilterRender,
    context: Context,
    onLineUpFinished: () -> Unit
){
    // Add or remove the overlay filter based on visibility.
    LaunchedEffect(visible) {
        if (visible && genericStream.isOnPreview) {
            genericStream.getGlInterface().clearFilters()
            genericStream.getGlInterface().addFilter(lineUpFilter)
        } else {
            genericStream.getGlInterface().removeFilter(lineUpFilter)
        }


        if (visible) {
            drawTeamPlayersOverlay(
                context = context,
                screenWidth = screenWidth,
                screenHeight = screenHeight,
                leftLogoBitmap = leftLogo,
                rightLogoBitmap = rightLogo,
                leftTeamName = team1Name,
                rightTeamName = team2Name,
                leftTeamPlayers = team1Players,
                rightTeamPlayers = team2Players,
                imageObjectFilterRender = lineUpFilter,
                isOnPreview = genericStream.isOnPreview
            )

            val teamPlayersOverlayDelay = selectedTeamsOverlayDuration.split("s").first()
            delay(teamPlayersOverlayDelay.toLong() * 1000)
            genericStream.getGlInterface().removeFilter(lineUpFilter)
            onLineUpFinished()
        }
    }
}

it crashes. But if I turn on each filter separately, first scoreboard, then I turn off scoreboard and I turn on line up it works good without problem. So it maybe has something to do with the way it clearFilters? Not sure about it, I will keep an eye on the behaviour to see if I can get close to the issue.

@danielhergil
Copy link
Author

danielhergil commented Apr 1, 2025

Okay I have found something. If I introduce a delay between clearFilter and addFilter it is not crashing anymore:

fun TeamPlayersOverlay(
    visible: Boolean,
    genericStream: GenericStream,
    screenWidth: Int,
    screenHeight: Int,
    team1Name: String,
    team2Name: String,
    team1Players: List<PlayerEntry>,
    team2Players: List<PlayerEntry>,
    leftLogo: Bitmap,
    rightLogo: Bitmap,
    selectedTeamsOverlayDuration: String,
    lineUpFilter: ImageObjectFilterRender,
    context: Context,
    onLineUpFinished: () -> Unit
){
    // Add or remove the overlay filter based on visibility.
    LaunchedEffect(visible) {
        if (visible && genericStream.isOnPreview) {
            genericStream.getGlInterface().clearFilters()
            delay(100)
            genericStream.getGlInterface().addFilter(lineUpFilter)
        } else {
            genericStream.getGlInterface().removeFilter(lineUpFilter)
        }


        if (visible) {
            drawTeamPlayersOverlay(
                context = context,
                screenWidth = screenWidth,
                screenHeight = screenHeight,
                leftLogoBitmap = leftLogo,
                rightLogoBitmap = rightLogo,
                leftTeamName = team1Name,
                rightTeamName = team2Name,
                leftTeamPlayers = team1Players,
                rightTeamPlayers = team2Players,
                imageObjectFilterRender = lineUpFilter,
                isOnPreview = genericStream.isOnPreview
            )

            val teamPlayersOverlayDelay = selectedTeamsOverlayDuration.split("s").first()
            delay(teamPlayersOverlayDelay.toLong() * 1000)
            genericStream.getGlInterface().removeFilter(lineUpFilter)
            onLineUpFinished()
        }
    }
}

I dont know if that can help, but for now is what I have found.

P.S: I am working in the commit e850eb2fc9 btw.

@pedroSG94
Copy link
Owner

Hello,

Thank you for the report. I will try using the same way that you did to reproduce the error:

  • clear and add to set a filter
  • Remove using the filter object

@pedroSG94
Copy link
Owner

Hello,

I was testing it but I'm not able to reproduce the error in my devices.
I tried with your app without luck.

@pedroSG94
Copy link
Owner

Anyway, I did a commit that maybe fix the error:

  implementation 'com.github.pedroSG94.RootEncoder:library:315929ed7e'
  //Optional, allow use CameraXSource and CameraUvcSource 
  implementation 'com.github.pedroSG94.RootEncoder:extra-sources:315929ed7e'

@danielhergil
Copy link
Author

Hello! For me it still crashing if I do not set the delay between clearFilters and addFilter. Maybe it depends on the device processor, but knowing that is enough to avoid the crash, because is causes no impact in the app or development.

Are the commits 315929ed7e or e850eb2fc9 going to be in the next release?

@pedroSG94
Copy link
Owner

Yes, I have plan to add it to the next releaase.
Just to get more info, which device are you using? (model and Android version)

@danielhergil
Copy link
Author

Nice! I am normally using Samsung Galaxy Note 10+ with Android version 12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants