Files
sherpa-onnx/scripts/node-addon-api
Fangjun Kuang f2e01fe8e3 Widen VAD sample positions to int64_t to fix long-stream SIGSEGV. (#4079)
Fixes #3635

It is for v2.0.0 and breaks the ABI.

CircularBuffer::head_ and tail_ are absolute sample counters that grow
forever. As int32_t they overflow after 2^31 samples (~37 h at 16 kHz);
tail_ % capacity then goes negative and std::copy() writes to an invalid
iterator, crashing long-running VAD streams.

Widen every absolute stream position to int64_t. Counts and capacities
(Push/Pop/Get's n, Size(), capacity) stay int32_t — they are bounded by
buffer memory, not stream duration.
2026-10-22 23:39:59 +08:00
..
2024-05-12 12:03:43 +08:00
2026-01-14 22:39:08 +08:00
2026-01-14 22:39:08 +08:00

Introduction

This folder contains node-addon-api wrapper for sherpa-onnx.

Caution: This folder is for developer only.

Usage

git clone https://github.com/k2-fsa/sherpa-onnx
cd sherpa-onnx
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON ..
make -j install
export PKG_CONFIG_PATH=$PWD/install:$PKG_CONFIG_PATH
cd ../scripts/node-addon-api/
npm i
./node_modules/.bin/cmake-js compile --log-level verbose

# see test/test_asr_streaming_transducer.js
# for usages

Please see doc at https://k2-fsa.github.io/sherpa/onnx/javascript-api/index.html.

API doc can be found at https://k2-fsa.github.io/sherpa/onnx/javascript-api/html/index.html