title: WebRtcAudioRecord.context is leaking reported by leak canary. How to solve?
body: <p>My webrtc Android native application has issue with <code>WebRtcAudioRecord.context</code>. Leak canary is continuously reporting that <code>WebRtcAudioRecord.class</code> is leaking memory.</p>
  <p>I do dispose my webrtc components this way:</p>
  <pre><code> peerConnection?.dispose()
   videoCapture?.dispose()
   videoSource?.dispose()
   factory.dispose()
   PeerConnectionFactory.stopInternalTracingCapture()
   PeerConnectionFactory.shutdownInternalTracer()
  </code></pre>
  <p>But Leak canary still keep reporting that <code>WebRtcAudioRecord.context</code> is leaking.
  Any idea how to solve this issue?</p>
  <p>My application doesn't stream audio is only streaming video.</p>
  <p>This is the canary memory leak report:</p>
  <blockquote>
  <p>┬─── │ GC Root: Global variable in native code │ ├─
  org.webrtc.audio.WebRtcAudioRecord instance │    Leaking: UNKNOWN │<br />
  Retaining 99 B in 2 objects │    context instance of .ui.activities. │
  MainActivity with mDestroyed = true │    ↓ WebRtcAudioRecord.context │</p>
  <p>╰→ .ui.activities.MainActivity instance ​     Leaking: YES
  (ObjectWatcher was watching this because .ui.activities.MainActivity
  received Activity#onDestroy() ​     callback and Activity#mDestroyed
  is 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</p>
  <p>METADATA</p>
  <p>Build.VERSION.SDK_INT: 29 Build.MANUFACTURER: HUAWEI LeakCanary
  version: 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=29
  171709] Heap dump reason: 8 retained objects, app is visible Analysis
  duration: 4019 ms</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/HVEER.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HVEER.jpg" alt="enter image description here" /></a></p>