Skip to content

Guard Android codec-store probing on API 36+ with an opt-out switch - #366

Closed
wang-bin with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-native-crash-api-36
Closed

Guard Android codec-store probing on API 36+ with an opt-out switch#366
wang-bin with Copilot wants to merge 1 commit into
masterfrom
copilot/fix-native-crash-api-36

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown

Android 16 / API 36 devices can crash while probing codec capabilities in the OS NDK codec-store path before playback even starts. This change adds a defensive escape hatch so libmdk can avoid the risky AMediaCodecStore probing flow and fall back to the existing in-process codec list when needed.

  • Problem

    • API 36+ codec-store probing can hit the Android-side crash window in libmedia_codeclist_capabilities.so, regardless of the selected decoder or media URL.
    • The existing API-level gate was not sufficient for the affected OEM firmware, so a runtime bypass is needed.
  • What changed

    • Added a codec-list probing guard in the Android compat layer so the NDK codec-store path is only used when probing is explicitly enabled.
    • When disabled, the code falls back to the existing codec enumeration path instead of invoking the fragile NDK store entry points.
    • The bypass is exposed through log.codec_list=0 (with MDK_LOG_CODEC_LIST=0 accepted as an environment override) so affected devices can opt out without changing the default behavior.
// Disable the fragile codec-store probing path on affected Android 16+ devices
SetGlobalOption("log.codec_list", "0");
  • Compatibility impact
    • Default behavior stays unchanged for unaffected platforms and firmware.
    • On affected API 36+ devices, this provides a safer fallback path for decoder discovery without forcing the app to abandon libmdk.

Copilot AI changed the title [WIP] Fix native crash in OS codec store on Android 16 Guard Android codec-store probing on API 36+ with an opt-out switch Jul 30, 2026
Copilot AI requested a review from wang-bin July 30, 2026 15:08
@wang-bin wang-bin closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants