lcfrs commited on
Commit
5cff61b
·
unverified ·
1 Parent(s): d6e13b6

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

Browse files

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 CHANGED
@@ -228,6 +228,7 @@ Java_com_whispercpp_whisper_WhisperLib_00024Companion_benchMemcpy(JNIEnv *env, j
228
  UNUSED(thiz);
229
  const char *bench_ggml_memcpy = whisper_bench_memcpy_str(n_threads);
230
  jstring string = (*env)->NewStringUTF(env, bench_ggml_memcpy);
 
231
  }
232
 
233
  JNIEXPORT jstring JNICALL
@@ -236,4 +237,5 @@ Java_com_whispercpp_whisper_WhisperLib_00024Companion_benchGgmlMulMat(JNIEnv *en
236
  UNUSED(thiz);
237
  const char *bench_ggml_mul_mat = whisper_bench_ggml_mul_mat_str(n_threads);
238
  jstring string = (*env)->NewStringUTF(env, bench_ggml_mul_mat);
 
239
  }
 
228
  UNUSED(thiz);
229
  const char *bench_ggml_memcpy = whisper_bench_memcpy_str(n_threads);
230
  jstring string = (*env)->NewStringUTF(env, bench_ggml_memcpy);
231
+ return string;
232
  }
233
 
234
  JNIEXPORT jstring JNICALL
 
237
  UNUSED(thiz);
238
  const char *bench_ggml_mul_mat = whisper_bench_ggml_mul_mat_str(n_threads);
239
  jstring string = (*env)->NewStringUTF(env, bench_ggml_mul_mat);
240
+ return string;
241
  }