Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/whisper.wasm/emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ EMSCRIPTEN_BINDINGS(whisper) {
params.print_timestamps = true;
params.print_special = false;
params.translate = translate;
params.language = whisper_is_multilingual(g_contexts[index]) ? lang.c_str() : "en";
params.language = whisper_is_multilingual(g_contexts[index]) ? strdup(lang.c_str()) : "en";
params.n_threads = std::min(nthreads, std::min(16, mpow2(std::thread::hardware_concurrency())));
params.offset_ms = 0;

Expand Down Expand Up @@ -106,6 +106,9 @@ EMSCRIPTEN_BINDINGS(whisper) {
whisper_reset_timings(g_contexts[index]);
whisper_full(g_contexts[index], params, pcmf32.data(), pcmf32.size());
whisper_print_timings(g_contexts[index]);
if (params.language != nullptr && strcmp(params.language, "en") != 0) {
free((void*)params.language);
}
});
}

Expand Down
Loading