Open
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
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
Metadata
Metadata
Assignees
Labels
No labels