GetStream / webrtc-android

🛰️ A versatile WebRTC pre-compiled Android library that reflects the recent WebRTC updates to facilitate real-time video chat for Android and Compose.
https://getstream.github.io/webrtc-android/
Apache License 2.0
522 stars 55 forks source link

CapturerObserver.onFrame leaks native memory in libjingle_peerconnection_so.so #97

Closed StingEmperor closed 5 hours ago

StingEmperor commented 6 months ago

We created a capturer class very similar to ScreenCapturerAndroid, that uses DisplayManager over the media projection api. However, I have found that calling CapturerObserver.onFrameCaptured creates a memory leak that Android studio profiler blames on libjingle_peerconnection_so.so.

If I simply comment out the CapturerObserver.onFrameCaptured step, my video track is now broken but the memory leak is gone.

I can provide screenshots, more info, etc, upon request. tried with version 1.1.1 and 1.1.0

StingEmperor commented 6 months ago

the title should be "CapturerObserver.onFrameCaptured leaks native memory in libjingle_peerconnection_so.so" sorry

StingEmperor commented 2 weeks ago

i traced it back to HardwareVideoEncoder.deliverEncodedImage, if i just comment out the call to deliverEncodedImage i don't get the leak in the profiler... @skydoves can we get this looked into?

StingEmperor commented 5 hours ago

The leak was on our side, and i misread my profiler, sorry for the inconvenience