fix(runtime): update ffmpeg addon for SILK duration support
Refresh the four bundled platform binaries from NapNeko/ffmpegAddon commit 9ac944793ffdc2a1c5c55f16e24cb32185feb4ec, successful build 38025527136. Record artifact provenance and binary checksums. Add native regression coverage for standard SILK, QQ NTSILK, extensionless inputs, and truncated packets.
This commit is contained in:
1 parent
f85b28d23c
commit
4c83cc826e
6 files changed
+66
No files matched your search
@@ -72,6 +72,48 @@ describeBundledAddon('bundled native ffmpeg addon', () => {
|
||||
});
|
||||
afterAll(() => rmSync(tmpDir, { recursive: true, force: true }));
|
||||
|
||||
describe.each(['silk', 'ntsilk', 'extensionless'] as const)('%s duration', (format) => {
|
||||
it.each([0.02, 1, 2.5])('measures %s seconds from the encoded frames', async (seconds) => {
|
||||
const addon = loadBundledAddon();
|
||||
const wavPath = path.join(tmpDir, `duration-${format}-${seconds}.wav`);
|
||||
const recordPath = path.join(
|
||||
tmpDir,
|
||||
`duration-${format}-${seconds}${format === 'extensionless' ? '' : `.${format}`}`,
|
||||
);
|
||||
writeFileSync(wavPath, makeMonoWav(24_000, seconds));
|
||||
await addon.convertToNTSilkTct(wavPath, recordPath);
|
||||
|
||||
if (format === 'silk') {
|
||||
// Standard SILK has the same packets without the QQ container prefix.
|
||||
const encoded = readFileSync(recordPath);
|
||||
expect(encoded.subarray(0, 10)).toEqual(
|
||||
Buffer.concat([Buffer.from([0x02]), Buffer.from('#!SILK_V3', 'ascii')]),
|
||||
);
|
||||
writeFileSync(recordPath, encoded.subarray(1));
|
||||
}
|
||||
|
||||
expect(await addon.getDuration(recordPath)).toBeCloseTo(seconds, 6);
|
||||
});
|
||||
|
||||
it('rejects a truncated packet instead of reporting a duration', async () => {
|
||||
const addon = loadBundledAddon();
|
||||
const wavPath = path.join(tmpDir, `truncated-${format}.wav`);
|
||||
const recordPath = path.join(
|
||||
tmpDir,
|
||||
`truncated-${format}${format === 'extensionless' ? '' : `.${format}`}`,
|
||||
);
|
||||
writeFileSync(wavPath, makeMonoWav());
|
||||
await addon.convertToNTSilkTct(wavPath, recordPath);
|
||||
const encoded = readFileSync(recordPath);
|
||||
writeFileSync(
|
||||
recordPath,
|
||||
encoded.subarray(format === 'silk' ? 1 : 0, encoded.length - 1),
|
||||
);
|
||||
|
||||
await expect(addon.getDuration(recordPath)).rejects.toThrow(/Invalid data/);
|
||||
});
|
||||
});
|
||||
|
||||
it('converts a mono QQ-style SILK record to a decodable MP3 through the public transcode seam', async () => {
|
||||
const addon = loadBundledAddon();
|
||||
const wavPath = path.join(tmpDir, 'mono-input.wav');
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Bundled FFmpeg addon
|
||||
|
||||
These binaries are unmodified build artifacts from
|
||||
[NapNeko/ffmpegAddon](https://github.com/NapNeko/ffmpegAddon) (upstream package license: MIT).
|
||||
|
||||
- Source commit: [`9ac944793ffdc2a1c5c55f16e24cb32185feb4ec`](https://github.com/NapNeko/ffmpegAddon/commit/9ac944793ffdc2a1c5c55f16e24cb32185feb4ec)
|
||||
- Successful build: [38025527136](https://github.com/NapNeko/ffmpegAddon/actions/runs/38025527136)
|
||||
- Each downloaded artifact archive was verified against its GitHub SHA-256 digest before extraction.
|
||||
|
||||
| Bundled file | Upstream artifact | Binary SHA-256 |
|
||||
| --- | --- | --- |
|
||||
| `ffmpegAddon.win32.x64.node` | `ffmpeg-addon-windows` | `80a4dfbb170f093f4a64fe241b8583fb630c58219100cad7a3cad798f71864db` |
|
||||
| `ffmpegAddon.linux.x64.node` | `ffmpeg-addon-linux` | `b75e45ba54d3ba5dbea42ed0cbe13cbcc4a2e38e889272aca272913675ff6402` |
|
||||
| `ffmpegAddon.linux.arm64.node` | `ffmpeg-addon-linux-arm64` | `92f04767db5cb292a2158d8a7451a07c2cba9b4ba8654b18b7f668991c2c160b` |
|
||||
| `ffmpegAddon.darwin.arm64.node` | `ffmpeg-addon-macos-arm64` | `c578932c04b40e36b32601a86d3833dbd9892df13bd13dbe9355623da0144cbf` |
|
||||
|
||||
`getDuration(path)` supports standard SILK and QQ NTSILK containers, including
|
||||
files without an extension. It measures the encoded frames and rejects truncated
|
||||
packets. SnowLuma's existing voice upload path uses this duration when accepting
|
||||
an already encoded SILK file.
|
||||
|
||||
Run `pnpm test:native` from the repository root to exercise the bundled addon on
|
||||
Windows x64 or Linux x64/arm64. The tests generate synthetic audio and cover
|
||||
SILK/NTSILK durations, truncated packets, and QQ/QQ AI voice transcoding.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user