livekit / client-sdk-android

LiveKit SDK for Android
https://docs.livekit.io
Apache License 2.0
174 stars 69 forks source link

android.opengl.GLException:Failed to create EGL context: 0x3000 #258

Closed wzJun1 closed 1 year ago

wzJun1 commented 1 year ago

Describe the bug

My LiveKit runs in a separate activity. When I open the calling activity multiple times, the following error will occur. If this situation occurs, I will not be able to make calls unless I exit the entire app process:

android.opengl.GLException:Failed to create EGL context: 0x3000

It feels like the Eglcontext has not been released.

But I have already done the following in onDestroy.

room.disconnect()
room.release()

I have calculated that after approximately 20-30 normal calls, this situation will occur.

To Reproduce

After approximately multiple or (20-30) normal calls, this situation will occur

Device Info:

wzJun1 commented 1 year ago

this is my sdk configuration:

val options = RoomOptions(
    adaptiveStream = false,
    dynacast = false,
    audioTrackCaptureDefaults = LocalAudioTrackOptions(
        noiseSuppression = true,
        echoCancellation = true,
        autoGainControl = true,
        highPassFilter = true,
        typingNoiseDetection = true,
    ),
    videoTrackCaptureDefaults = LocalVideoTrackOptions(
        position = CameraPosition.FRONT,
        captureParams = VideoPreset169.VGA.capture,
    ),
    audioTrackPublishDefaults = AudioTrackPublishDefaults(
        audioBitrate = 20_000,
        dtx = false,
    ),
    videoTrackPublishDefaults = VideoTrackPublishDefaults(
        videoEncoding = VideoPreset169.VGA.encoding,
        videoCodec = VideoCodec.VP8.codecName
    )
)

//初始化聊天房间配置
room = LiveKit.create(
    applicationContext,
    overrides = LiveKitOverrides(
        audioHandler = audioHandler
    ),
    options = options
)
wzJun1 commented 1 year ago

The exception was thrown by 'initVideoRenderer'

fiather commented 1 year ago

I also have the same error as above. Even if the initVideoRenderer exception is processed, an error occurs at the end.

kgsl-3d0: KGSL active contexts: kgsl-3d0: pid process total attached detached kgsl-3d0: 16606 X.x.x.xx.x 201 201 0

fiather commented 1 year ago

I seem to have solved it. This was not a livekit problem, it was my problem.

wzJun1 commented 1 year ago

I seem to have solved it. This was not a livekit problem, it was my problem.

How to solve it?

fiather commented 1 year ago

I think you would have used textViewRenderer or surfaceViewRenderer.

Did you call the release of the renderer after using the renderer?

And you have to check the log of kgsl

fiather commented 1 year ago

You can see the text about release of the renderer in TextureViewRenderer.kt

wzJun1 commented 1 year ago

I think you would have used textViewRenderer or surfaceViewRenderer.

Did you call the release of the renderer after using the renderer?

And you have to check the log of kgsl

Yes, as you said.

Now I will use TextureViewRenderer and try to call release.

thx!

wzJun1 commented 9 months ago

@fiather @davidliu

You can see the text about release of the renderer in TextureViewRenderer.kt

I used RecyclView, and even if I called release(), this error still occurs. Is there a solution or sample code to refer to?