From 0cf5dfec2c8313fc2ed2aab8d10bf3dc4b9c283f Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期四, 14 三月 2024 14:41:49 +0800
Subject: [PATCH] update cmakelist
---
runtime/onnxruntime/src/funasrruntime.cpp | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/runtime/onnxruntime/src/funasrruntime.cpp b/runtime/onnxruntime/src/funasrruntime.cpp
index c4cb9d9..d795cb0 100644
--- a/runtime/onnxruntime/src/funasrruntime.cpp
+++ b/runtime/onnxruntime/src/funasrruntime.cpp
@@ -33,9 +33,9 @@
return mm;
}
- _FUNASRAPI FUNASR_HANDLE FunOfflineInit(std::map<std::string, std::string>& model_path, int thread_num)
+ _FUNASRAPI FUNASR_HANDLE FunOfflineInit(std::map<std::string, std::string>& model_path, int thread_num, bool use_gpu)
{
- funasr::OfflineStream* mm = funasr::CreateOfflineStream(model_path, thread_num);
+ funasr::OfflineStream* mm = funasr::CreateOfflineStream(model_path, thread_num, use_gpu);
return mm;
}
@@ -146,6 +146,7 @@
funasr::FUNASR_VAD_RESULT* p_result = new funasr::FUNASR_VAD_RESULT;
p_result->snippet_time = audio.GetTimeLen();
if(p_result->snippet_time == 0){
+ p_result->segments = new vector<std::vector<int>>();
return p_result;
}
@@ -178,6 +179,7 @@
funasr::FUNASR_VAD_RESULT* p_result = new funasr::FUNASR_VAD_RESULT;
p_result->snippet_time = audio.GetTimeLen();
if(p_result->snippet_time == 0){
+ p_result->segments = new vector<std::vector<int>>();
return p_result;
}
@@ -243,7 +245,7 @@
return p_result;
}
if(offline_stream->UseVad()){
- audio.Split(offline_stream);
+ audio.CutSplit(offline_stream);
}
float* buff;
@@ -341,7 +343,7 @@
return p_result;
}
if(offline_stream->UseVad()){
- audio.Split(offline_stream);
+ audio.CutSplit(offline_stream);
}
float* buff;
@@ -478,7 +480,7 @@
audio->Split(vad_online_handle, chunk_len, input_finished, mode);
- funasr::AudioFrame* frame = NULL;
+ funasr::AudioFrame* frame = nullptr;
while(audio->FetchChunck(frame) > 0){
string msg = ((funasr::ParaformerOnline*)asr_online_handle)->Forward(frame->data, frame->len, frame->is_final);
if(mode == ASR_ONLINE){
@@ -502,9 +504,9 @@
}else if(mode == ASR_TWO_PASS){
p_result->msg += msg;
}
- if(frame != NULL){
+ if(frame != nullptr){
delete frame;
- frame = NULL;
+ frame = nullptr;
}
}
@@ -559,9 +561,9 @@
if (!(p_result->stamp).empty()){
p_result->stamp_sents = funasr::TimestampSentence(p_result->tpass_msg, p_result->stamp);
}
- if(frame != NULL){
+ if(frame != nullptr){
delete frame;
- frame = NULL;
+ frame = nullptr;
}
}
--
Gitblit v1.9.1