@@ -70,8 +70,10 @@ static void CircularBufferPushWrapper(const Napi::CallbackInfo &info) {
7070
7171#if __OHOS__
7272 // Note(fangjun): Normally, we don't need to divied it by sizeof(float).
73- // However, data.ElementLength() here returns number of bytes, not number of elements.
74- SherpaOnnxCircularBufferPush (buf, data.Data (), data.ElementLength () / sizeof (float ));
73+ // However, data.ElementLength() here returns number of bytes, not number of
74+ // elements.
75+ SherpaOnnxCircularBufferPush (buf, data.Data (),
76+ data.ElementLength () / sizeof (float ));
7577#else
7678 SherpaOnnxCircularBufferPush (buf, data.Data (), data.ElementLength ());
7779#endif
@@ -353,10 +355,14 @@ CreateVoiceActivityDetectorWrapper(const Napi::CallbackInfo &info) {
353355 float buffer_size_in_seconds = info[1 ].As <Napi::Number>().FloatValue ();
354356
355357#if __OHOS__
356- std::unique_ptr<NativeResourceManager, decltype (&OH_ResourceManager_ReleaseNativeResourceManager)> mgr (OH_ResourceManager_InitNativeResourceManager (env, info[2 ]), &OH_ResourceManager_ReleaseNativeResourceManager);
358+ std::unique_ptr<NativeResourceManager,
359+ decltype (&OH_ResourceManager_ReleaseNativeResourceManager)>
360+ mgr (OH_ResourceManager_InitNativeResourceManager (env, info[2 ]),
361+ &OH_ResourceManager_ReleaseNativeResourceManager);
357362
358363 SherpaOnnxVoiceActivityDetector *vad =
359- SherpaOnnxCreateVoiceActivityDetectorOHOS (&c, buffer_size_in_seconds, mgr.get ());
364+ SherpaOnnxCreateVoiceActivityDetectorOHOS (&c, buffer_size_in_seconds,
365+ mgr.get ());
360366#else
361367 SherpaOnnxVoiceActivityDetector *vad =
362368 SherpaOnnxCreateVoiceActivityDetector (&c, buffer_size_in_seconds);
@@ -410,9 +416,10 @@ static void VoiceActivityDetectorAcceptWaveformWrapper(
410416 Napi::Float32Array samples = info[1 ].As <Napi::Float32Array>();
411417
412418#if __OHOS__
413- // Note(fangjun): For unknown reasons, we need to use `/sizeof(float)` here for Huawei
414- SherpaOnnxVoiceActivityDetectorAcceptWaveform (vad, samples.Data (),
415- samples.ElementLength () / sizeof (float ));
419+ // Note(fangjun): For unknown reasons, we need to use `/sizeof(float)` here
420+ // for Huawei
421+ SherpaOnnxVoiceActivityDetectorAcceptWaveform (
422+ vad, samples.Data (), samples.ElementLength () / sizeof (float ));
416423#else
417424 SherpaOnnxVoiceActivityDetectorAcceptWaveform (vad, samples.Data (),
418425 samples.ElementLength ());
0 commit comments