whisper.android : return output from benchmarks (#1785)

Benchmarks are failing because JNI expects a jstring and the benchmarks
are missing a return statement (i.e., returning null). The functions
actually build a jstring but don't return it, so this seems to have been
an oversight.

This patch returns the jstring and now the benchmarks run successfully.

Fixes #1783.
This commit is contained in:
Neuman Vong 2024-01-20 01:17:38 +11:00 committed by GitHub
parent c0329acde8
commit d6b9be21d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -228,6 +228,7 @@ Java_com_whispercpp_whisper_WhisperLib_00024Companion_benchMemcpy(JNIEnv *env, j
UNUSED(thiz); UNUSED(thiz);
const char *bench_ggml_memcpy = whisper_bench_memcpy_str(n_threads); const char *bench_ggml_memcpy = whisper_bench_memcpy_str(n_threads);
jstring string = (*env)->NewStringUTF(env, bench_ggml_memcpy); jstring string = (*env)->NewStringUTF(env, bench_ggml_memcpy);
return string;
} }
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
@ -236,4 +237,5 @@ Java_com_whispercpp_whisper_WhisperLib_00024Companion_benchGgmlMulMat(JNIEnv *en
UNUSED(thiz); UNUSED(thiz);
const char *bench_ggml_mul_mat = whisper_bench_ggml_mul_mat_str(n_threads); const char *bench_ggml_mul_mat = whisper_bench_ggml_mul_mat_str(n_threads);
jstring string = (*env)->NewStringUTF(env, bench_ggml_mul_mat); jstring string = (*env)->NewStringUTF(env, bench_ggml_mul_mat);
return string;
} }