]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
whisper.android : return output from benchmarks (#1785)
authorNeuman Vong <redacted>
Fri, 19 Jan 2024 14:17:38 +0000 (01:17 +1100)
committerGitHub <redacted>
Fri, 19 Jan 2024 14:17:38 +0000 (16:17 +0200)
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.

examples/whisper.android/lib/src/main/jni/whisper/jni.c

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