1
0
mirror of git://f0xx.org/ac/ac-mobile-android synced 2026-07-29 02:58:06 +03:00
Files
ac-mobile-android/ndk
Anton Afanasyeu fb8b0c43e7 codecs: add native build scripts for libvpx/opus/speex + fix CMake includes
- scripts/build-native-codecs.sh: cross-compile libvpx, opus, speex for
  Android ABIs (arm64-v8a, armeabi-v7a, x86_64) using NDK clang with -fPIC
- scripts/android-ndk.sh: NDK root detection helper
- scripts/native-build-cache.sh: ccache detection helper
- scripts/init-third-party-submodules.sh: init codec submodules
- scripts/ensure-gradle-wrapper.sh: gradle wrapper sanity check
- scripts/adb-reconnect.sh: ADB device discovery helpers
- ndk/CMakeLists.txt: per-ABI include dirs for opus/ and speex_config_types.h

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 23:07:17 +02:00
..
2026-06-23 12:30:10 +02:00
2026-06-23 12:30:10 +02:00

Native codecs (libvpx, Opus, Speex)

The app loads libandroidcast_codecs.so for availability probes and future software encode/decode paths.

Current status

Component Java Native Notes
FEC 3/4 + RS Yes v2 per-shard on wire (FecShardWire); v1 monolithic decode still accepted
NACK + retransmit cache Yes UDP MSG_NACK, combined with FEC when enabled
libvpx VP8/VP9 Native Encode + decode Screen cast via ImageReader; receiver libvpx (decoder uses VPX_CODEC_USE_ERROR_CONCEALMENT when supported) or MediaCodec fallback
Opus / Speex Probe + static link when lib*.a built Encode/decode JNI sinks scripts/build-native-codecs.sh → CMake autolink

Enable native codecs (developer)

  1. Initialize all third-party submodules:

    bash scripts/init-third-party-submodules.sh
    
  2. Build static libs per ABI (NDK auto-detected via scripts/android-ndk.sh):

    ./scripts/build-native-codecs.sh arm64-v8a
    ./scripts/build-native-codecs.sh armeabi-v7a   # if shipped in APK
    

    If the repo path has spaces, the script stages under /tmp/androidcast-libvpx-$USER.

  3. Gradle / CMake link build/native/<abi>/lib*.a when present and set ANDROIDCAST_HAVE_LIBVPX, ANDROIDCAST_HAVE_OPUS, ANDROIDCAST_HAVE_SPEEX accordingly.

  4. ./gradlew assembleDebug

Optional override: ANDROIDCAST_LIBVPX_LIB only applies when its path contains the current ABI name (e.g. .../arm64-v8a/libvpx.a).

ABIs without matching .a files still build; missing codecs are disabled on those architectures.

Stream protection defaults

  • Default: None (no FEC/NACK)
  • Enable in Global settings → Stream protection (UDP)
  • After handshake, sender and receiver negotiate the effective mode (no protocol version bump)
  • Until negotiation completes, UDP protection stays off; peers without FEC support ignore protected frames

Full checklist: docs/ROADMAP.md