1
0
mirror of git://f0xx.org/ac/ac-mobile-android synced 2026-07-29 04:18:25 +03:00

Add adaptive jitter buffer, BWE, and mid-session codec renegotiation.

Receiver pipeline gets configurable jitter buffering with live stats in the debug overlay; sender/receiver share AdaptiveNetworkControlPlane for congestion-aware bitrate and codec switches without a protocol version bump.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-07-08 14:55:13 +02:00
parent fb8b0c43e7
commit 4c15be763b
54 changed files with 2210 additions and 49 deletions

View File

@@ -35,6 +35,7 @@
typedef struct {
unsigned long magic;
vpx_codec_ctx_t codec;
vpx_codec_enc_cfg_t cfg;
vpx_image_t img;
int width;
int height;
@@ -209,6 +210,7 @@ Java_com_foxx_androidcast_media_codec_jni_NativeCodecBridge_nativeVpxEncoderCrea
(*env)->ReleaseStringUTFChars(env, mime, mime_utf);
return 0L;
}
ctx->cfg = cfg;
/* VP8 and VP9 both use VP8E_SET_CPUUSED (see libvpx tests / vp9_cx_iface.c). */
vpx_codec_control(&ctx->codec, VP8E_SET_CPUUSED, 8);
@@ -338,6 +340,28 @@ Java_com_foxx_androidcast_media_codec_jni_NativeCodecBridge_nativeVpxRequestKeyf
#endif
}
JNIEXPORT jboolean JNICALL
Java_com_foxx_androidcast_media_codec_jni_NativeCodecBridge_nativeVpxSetBitrate(
JNIEnv *env, jclass clazz, jlong handle, jint bitrateKbps) {
(void) env;
(void) clazz;
#if !ANDROIDCAST_HAVE_LIBVPX
(void) handle;
(void) bitrateKbps;
return JNI_FALSE;
#else
VpxEncoderCtx *ctx = enc_from_handle(handle);
if (ctx == NULL || bitrateKbps <= 0) {
return JNI_FALSE;
}
ctx->cfg.rc_target_bitrate = bitrateKbps;
if (vpx_codec_enc_config_set(&ctx->codec, &ctx->cfg) != VPX_CODEC_OK) {
return JNI_FALSE;
}
return JNI_TRUE;
#endif
}
JNIEXPORT jlong JNICALL
Java_com_foxx_androidcast_media_codec_jni_NativeCodecBridge_nativeVpxDecoderCreate(
JNIEnv *env, jclass clazz, jstring mime) {