MediaCodec: throw IOException for unimplemented codecs

fixes SEGFAULT when libavcodec is built without aac decoder
This commit is contained in:
Julian Winkler
2024-06-12 16:37:21 +02:00
parent 47e070bec6
commit 5454d9ed3c
2 changed files with 8 additions and 2 deletions

View File

@@ -60,6 +60,8 @@ JNIEXPORT jlong JNICALL Java_android_media_MediaCodec_native_1constructor(JNIEnv
const char *name = (*env)->GetStringUTFChars(env, codec_name, NULL);
const AVCodec *codec = avcodec_find_decoder_by_name(name);
(*env)->ReleaseStringUTFChars(env, codec_name, name);
if (!codec)
return 0;
AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
struct ATL_codec_context *ctx = calloc(1, sizeof(struct ATL_codec_context));