Skip to content

MediaCodec (C2NodeImpl) leak on USB camera detach/reattach cycle #147

@cytew

Description

@cytew

Description:

  • Library version: 1.0.12
  • Pattern: Each USB camera detach → reattach cycle leaks ~3 C2NodeImpl (Codec2 framework component nodes) that remain alive until app process termination.
  • Tested on Samsung devices (Android 14)
  • Perfetto trace shows the codec threads created at the time of camera
    initialization persist beyond device detach.

Reproduction:

  1. Connect USB UVC camera
  2. Start preview / open camera
  3. Detach USB
  4. Reattach USB
  5. Repeat → C2NodeImpl count grows linearly

Expected: codec instances released on camera close/USB detach
Actual: codec instances persist; ~3 per cycle accumulated

Note: This is distinct from the image cache leak fixed in #125 (1.0.11).
That fix recycled UVC raw frame buffers in UVCPreview.cpp, but C2NodeImpl
instances (Android Codec2 framework) remain leaked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions