1
0
mirror of git://f0xx.org/android_cast synced 2026-07-29 05:58:14 +03:00
This commit is contained in:
Anton Afanasyeu
2026-05-19 12:23:39 +02:00
parent 0647e0b2a0
commit 35ab5622d7
47 changed files with 1598 additions and 150 deletions

View File

@@ -342,9 +342,15 @@ Java_com_foxx_androidcast_media_codec_jni_NativeCodecBridge_nativeVpxDecoderCrea
return 0L;
}
ctx->magic = VPX_DEC_MAGIC;
vpx_codec_iface_t *iface = pick_decoder_iface(mime_utf);
vpx_codec_dec_cfg_t cfg = {0};
cfg.threads = 1;
if (vpx_codec_dec_init(&ctx->codec, pick_decoder_iface(mime_utf), &cfg, 0) != VPX_CODEC_OK) {
/* vpxdec.c: dec_flags |= VPX_CODEC_USE_ERROR_CONCEALMENT when --error-concealment */
int dec_flags = 0;
if (vpx_codec_get_caps(iface) & VPX_CODEC_CAP_ERROR_CONCEALMENT) {
dec_flags |= VPX_CODEC_USE_ERROR_CONCEALMENT;
}
if (vpx_codec_dec_init(&ctx->codec, iface, &cfg, dec_flags) != VPX_CODEC_OK) {
free(ctx);
(*env)->ReleaseStringUTFChars(env, mime, mime_utf);
return 0L;
@@ -381,9 +387,8 @@ Java_com_foxx_androidcast_media_codec_jni_NativeCodecBridge_nativeVpxDecodeFrame
vpx_codec_err_t err = vpx_codec_decode(&ctx->codec, (const uint8_t *) bytes, (unsigned int) len,
NULL, 0);
(*env)->ReleaseByteArrayElements(env, data, bytes, JNI_ABORT);
if (err != VPX_CODEC_OK) {
return JNI_FALSE;
}
/* With error concealment, vpx_codec_decode may warn yet still output a frame (see vpxdec.c). */
(void) err;
ANativeWindow *window = ANativeWindow_fromSurface(env, surface);
if (window == NULL) {