正在显示
1 个修改的文件
包含
2 行增加
和
2 行删除
| @@ -222,7 +222,7 @@ const SherpaOnnxOnlineRecognizerResult *GetOnlineStreamResult( | @@ -222,7 +222,7 @@ const SherpaOnnxOnlineRecognizerResult *GetOnlineStreamResult( | ||
| 222 | } | 222 | } |
| 223 | r->tokens_arr = tokens_temp; | 223 | r->tokens_arr = tokens_temp; |
| 224 | 224 | ||
| 225 | - if (!result.timestamps.empty()) { | 225 | + if (!result.timestamps.empty() && result.timestamps.size() == r->count) { |
| 226 | r->timestamps = new float[r->count]; | 226 | r->timestamps = new float[r->count]; |
| 227 | std::copy(result.timestamps.begin(), result.timestamps.end(), | 227 | std::copy(result.timestamps.begin(), result.timestamps.end(), |
| 228 | r->timestamps); | 228 | r->timestamps); |
| @@ -490,7 +490,7 @@ const SherpaOnnxOfflineRecognizerResult *GetOfflineStreamResult( | @@ -490,7 +490,7 @@ const SherpaOnnxOfflineRecognizerResult *GetOfflineStreamResult( | ||
| 490 | } | 490 | } |
| 491 | r->tokens_arr = tokens_temp; | 491 | r->tokens_arr = tokens_temp; |
| 492 | 492 | ||
| 493 | - if (!result.timestamps.empty()) { | 493 | + if (!result.timestamps.empty() && result.timestamps.size() == r->count) { |
| 494 | r->timestamps = new float[r->count]; | 494 | r->timestamps = new float[r->count]; |
| 495 | std::copy(result.timestamps.begin(), result.timestamps.end(), | 495 | std::copy(result.timestamps.begin(), result.timestamps.end(), |
| 496 | r->timestamps); | 496 | r->timestamps); |
-
请 注册 或 登录 后发表评论