gpt4 book ai didi

android - WebRtcAudioRecord.context 由泄漏金丝雀报告泄漏。怎么解决?

转载 作者:行者123 更新时间:2023-12-04 23:49:56 27 4
gpt4 key购买 nike

我的 webrtc Android native 应用程序与 WebRtcAudioRecord.context 存在问题.泄漏金丝雀不断报告WebRtcAudioRecord.class正在泄漏内存。
我确实以这种方式处理我的 webrtc 组件:

 peerConnection?.dispose()
videoCapture?.dispose()
videoSource?.dispose()
factory.dispose()
PeerConnectionFactory.stopInternalTracingCapture()
PeerConnectionFactory.shutdownInternalTracer()
但是 Leak canary 仍然不断报告 WebRtcAudioRecord.context正在泄漏。
知道如何解决这个问题吗?
我的应用程序不流式传输音频只是流式传输视频。
这是金丝雀内存泄漏报告:

┬─── │ GC Root: Global variable in native code │ ├─org.webrtc.audio.WebRtcAudioRecord instance │ Leaking: UNKNOWN │
Retaining 99 B in 2 objects │ context instance of .ui.activities. │MainActivity with mDestroyed = true │ ↓ WebRtcAudioRecord.context │

╰→ .ui.activities.MainActivity instance ​ Leaking: YES(ObjectWatcher was watching this because .ui.activities.MainActivityreceived Activity#onDestroy() ​ callback and Activity#mDestroyedis true) ​ Retaining 153.0 kB in 2750 objects ​ key =33e94f80-0004-4aeb-b351-dab64a8280da ​ watchDurationMillis = 5134​ retainedDurationMillis = 134 ​ mApplication instance of .App​ mBase instance of androidx.appcompat.view.ContextThemeWrapper

METADATA

Build.VERSION.SDK_INT: 29 Build.MANUFACTURER: HUAWEI LeakCanaryversion: 2.6 App process name: some.app Count of retained yet cleared:10 KeyedWeakReference instances Stats:LruCache[maxSize=3000,hits=4250,misses=80514,hitRate=5%]RandomAccess[bytes=4071605,reads=80514,travel=36763422162,range=23400016,size=29171709] Heap dump reason: 8 retained objects, app is visible Analysisduration: 4019 ms


enter image description here

最佳答案

我找到了原因!
对我来说,它是

 val options = PeerConnectionFactory.InitializationOptions.builder(context)
.setEnableInternalTracer(true)
.setFieldTrials("WebRTC-H264HighProfile/Enabled/")
.createInitializationOptions()
我在这里为构建器传递了 Activity 上下文而不是应用程序上下文。

关于android - WebRtcAudioRecord.context 由泄漏金丝雀报告泄漏。怎么解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66486257/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com