Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Got drawCamera start. GL error: 1281 after version 2.5.8

Open
#1,785 46 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
18/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, java, kotlin
Domain
mobile-dev

Research direction

The crash is raised from GlUtil.checkGlError in com/pedro/encoder/utils/gl/GlUtil.java, called from CameraRender.draw in CameraRender.java around line 99, reached through MainRender.kt drawOffScreen and GlStreamInterface.kt. Start by reading the two linked commits to see what changed in the camera render path between 2.5.8 versions. Done would mean a reproducible fix for GL error 1281 on the SurfaceView preview path, but the thread has 46 comments and no decision, so confirm with maintainers first.

Written by the indexing model from the issue text.

Description

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
https://github.com/pedroSG94/RootEncoder/commit/8fdb2831d18257ceacdb5c620fd1bf95c6563600

But I thing after this other change
https://github.com/pedroSG94/RootEncoder/commit/1c5482d38c5834bf8e14866ec708d2d6f5cb48dc
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

Dominant language
Kotlin
Stars
3k
Forks
946
Avg merge
4d 6h
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pedroSG94/RootEncoder

All issues in pedroSG94/RootEncoder

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.