HarmonyOS support for VAD. (#1561)

This commit is contained in:
Fangjun Kuang
2024-11-24 16:29:24 +08:00
committed by GitHub
parent e424cc9e0d
commit 31d6206fde
15 changed files with 231 additions and 71 deletions

View File

@@ -37,8 +37,9 @@ class SileroVadModel::Impl {
min_speech_samples_ = sample_rate_ * config_.silero_vad.min_speech_duration;
}
#if __ANDROID_API__ >= 9
Impl(AAssetManager *mgr, const VadModelConfig &config)
#if __ANDROID_API__ >= 9 || defined(__OHOS__)
template <typename Manager>
Impl(Manager *mgr, const VadModelConfig &config)
: config_(config),
env_(ORT_LOGGING_LEVEL_ERROR),
sess_opts_(GetSessionOptions(config)),
@@ -437,6 +438,12 @@ SileroVadModel::SileroVadModel(AAssetManager *mgr, const VadModelConfig &config)
: impl_(std::make_unique<Impl>(mgr, config)) {}
#endif
#if __OHOS__
SileroVadModel::SileroVadModel(NativeResourceManager *mgr,
const VadModelConfig &config)
: impl_(std::make_unique<Impl>(mgr, config)) {}
#endif
SileroVadModel::~SileroVadModel() = default;
void SileroVadModel::Reset() { return impl_->Reset(); }