@livekit/rtc-node 0.11.1 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audio_frame.cjs +94 -0
- package/dist/audio_frame.cjs.map +1 -0
- package/dist/audio_frame.js +64 -67
- package/dist/audio_frame.js.map +1 -1
- package/dist/audio_resampler.cjs +153 -0
- package/dist/audio_resampler.cjs.map +1 -0
- package/dist/audio_resampler.js +129 -134
- package/dist/audio_resampler.js.map +1 -1
- package/dist/audio_source.cjs +116 -0
- package/dist/audio_source.cjs.map +1 -0
- package/dist/audio_source.js +92 -85
- package/dist/audio_source.js.map +1 -1
- package/dist/audio_stream.cjs +104 -0
- package/dist/audio_stream.cjs.map +1 -0
- package/dist/audio_stream.js +77 -78
- package/dist/audio_stream.js.map +1 -1
- package/dist/e2ee.cjs +268 -0
- package/dist/e2ee.cjs.map +1 -0
- package/dist/e2ee.d.ts.map +1 -1
- package/dist/e2ee.js +244 -221
- package/dist/e2ee.js.map +1 -1
- package/dist/ffi_client.cjs +95 -0
- package/dist/ffi_client.cjs.map +1 -0
- package/dist/ffi_client.d.ts +2 -2
- package/dist/ffi_client.d.ts.map +1 -1
- package/dist/ffi_client.js +67 -48
- package/dist/ffi_client.js.map +1 -1
- package/dist/index.cjs +166 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +119 -48
- package/dist/index.js.map +1 -1
- package/dist/napi/native.d.cjs +17 -0
- package/dist/napi/native.d.cjs.map +1 -0
- package/dist/napi/native.d.js +1 -0
- package/dist/napi/native.d.js.map +1 -0
- package/dist/native.cjs +301 -0
- package/dist/native.d.ts +19 -0
- package/dist/native.js +15 -0
- package/dist/participant.cjs +388 -0
- package/dist/participant.cjs.map +1 -0
- package/dist/participant.js +363 -339
- package/dist/participant.js.map +1 -1
- package/dist/proto/audio_frame_pb.cjs +193 -0
- package/dist/proto/audio_frame_pb.cjs.map +1 -0
- package/dist/proto/audio_frame_pb.js +120 -320
- package/dist/proto/audio_frame_pb.js.map +1 -1
- package/dist/proto/e2ee_pb.cjs +131 -0
- package/dist/proto/e2ee_pb.cjs.map +1 -0
- package/dist/proto/e2ee_pb.js +76 -202
- package/dist/proto/e2ee_pb.js.map +1 -1
- package/dist/proto/ffi_pb.cjs +76 -0
- package/dist/proto/ffi_pb.cjs.map +1 -0
- package/dist/proto/ffi_pb.js +33 -92
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/proto/handle_pb.cjs +33 -0
- package/dist/proto/handle_pb.cjs.map +1 -0
- package/dist/proto/handle_pb.js +6 -22
- package/dist/proto/handle_pb.js.map +1 -1
- package/dist/proto/participant_pb.cjs +50 -0
- package/dist/proto/participant_pb.cjs.map +1 -0
- package/dist/proto/participant_pb.js +19 -57
- package/dist/proto/participant_pb.js.map +1 -1
- package/dist/proto/room_pb.cjs +370 -0
- package/dist/proto/room_pb.cjs.map +1 -0
- package/dist/proto/room_pb.js +239 -632
- package/dist/proto/room_pb.js.map +1 -1
- package/dist/proto/rpc_pb.cjs +63 -0
- package/dist/proto/rpc_pb.cjs.map +1 -0
- package/dist/proto/rpc_pb.js +26 -72
- package/dist/proto/rpc_pb.js.map +1 -1
- package/dist/proto/stats_pb.cjs +256 -0
- package/dist/proto/stats_pb.cjs.map +1 -0
- package/dist/proto/stats_pb.js +175 -456
- package/dist/proto/stats_pb.js.map +1 -1
- package/dist/proto/track_pb.cjs +116 -0
- package/dist/proto/track_pb.cjs.map +1 -0
- package/dist/proto/track_pb.js +65 -171
- package/dist/proto/track_pb.js.map +1 -1
- package/dist/proto/video_frame_pb.cjs +161 -0
- package/dist/proto/video_frame_pb.cjs.map +1 -0
- package/dist/proto/video_frame_pb.js +101 -269
- package/dist/proto/video_frame_pb.js.map +1 -1
- package/dist/room.cjs +440 -0
- package/dist/room.cjs.map +1 -0
- package/dist/room.js +384 -373
- package/dist/room.js.map +1 -1
- package/dist/rpc.cjs +89 -0
- package/dist/rpc.cjs.map +1 -0
- package/dist/rpc.js +59 -63
- package/dist/rpc.js.map +1 -1
- package/dist/track.cjs +100 -0
- package/dist/track.cjs.map +1 -0
- package/dist/track.js +66 -62
- package/dist/track.js.map +1 -1
- package/dist/track_publication.cjs +106 -0
- package/dist/track_publication.cjs.map +1 -0
- package/dist/track_publication.js +76 -74
- package/dist/track_publication.js.map +1 -1
- package/dist/transcription.cjs +17 -0
- package/dist/transcription.cjs.map +1 -0
- package/dist/transcription.js +0 -1
- package/dist/transcription.js.map +1 -1
- package/dist/types.cjs +17 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.js +0 -1
- package/dist/types.js.map +1 -1
- package/dist/version.cjs +29 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +4 -1
- package/dist/version.js.map +1 -1
- package/dist/video_frame.cjs +242 -0
- package/dist/video_frame.cjs.map +1 -0
- package/dist/video_frame.js +212 -201
- package/dist/video_frame.js.map +1 -1
- package/dist/video_source.cjs +63 -0
- package/dist/video_source.cjs.map +1 -0
- package/dist/video_source.d.ts.map +1 -1
- package/dist/video_source.js +42 -37
- package/dist/video_source.js.map +1 -1
- package/dist/video_stream.cjs +103 -0
- package/dist/video_stream.cjs.map +1 -0
- package/dist/video_stream.js +76 -77
- package/dist/video_stream.js.map +1 -1
- package/package.json +18 -9
- package/src/audio_frame.ts +2 -2
- package/src/audio_source.ts +2 -2
- package/src/e2ee.ts +2 -2
- package/src/ffi_client.ts +4 -4
- package/src/index.ts +14 -8
- package/src/version.ts +1 -1
- package/src/video_frame.ts +1 -1
- package/src/video_source.ts +5 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var audio_frame_exports = {};
|
|
20
|
+
__export(audio_frame_exports, {
|
|
21
|
+
AudioFrame: () => AudioFrame,
|
|
22
|
+
combineAudioFrames: () => combineAudioFrames
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(audio_frame_exports);
|
|
25
|
+
var import_protobuf = require("@bufbuild/protobuf");
|
|
26
|
+
var import_ffi_client = require("./ffi_client.cjs");
|
|
27
|
+
var import_audio_frame_pb = require("./proto/audio_frame_pb.cjs");
|
|
28
|
+
class AudioFrame {
|
|
29
|
+
// note: if converting from Uint8Array to Int16Array, *do not* use buffer.slice!
|
|
30
|
+
// it is marked unstable by Node and can cause undefined behaviour, such as massive chunks of
|
|
31
|
+
// noise being added to the end.
|
|
32
|
+
// it is recommended to use buffer.subarray instead.
|
|
33
|
+
// XXX(nbsp): add this when writing proper docs
|
|
34
|
+
constructor(data, sampleRate, channels, samplesPerChannel) {
|
|
35
|
+
this.data = data;
|
|
36
|
+
this.sampleRate = sampleRate;
|
|
37
|
+
this.channels = channels;
|
|
38
|
+
this.samplesPerChannel = samplesPerChannel;
|
|
39
|
+
}
|
|
40
|
+
static create(sampleRate, channels, samplesPerChannel) {
|
|
41
|
+
const data = new Int16Array(channels * samplesPerChannel);
|
|
42
|
+
return new AudioFrame(data, sampleRate, channels, samplesPerChannel);
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
45
|
+
static fromOwnedInfo(owned) {
|
|
46
|
+
const info = owned.info;
|
|
47
|
+
const len = info.numChannels * info.samplesPerChannel * 2;
|
|
48
|
+
const data = import_ffi_client.FfiClient.instance.copyBuffer(info.dataPtr, len);
|
|
49
|
+
new import_ffi_client.FfiHandle(owned.handle.id).dispose();
|
|
50
|
+
return new AudioFrame(
|
|
51
|
+
new Int16Array(data.buffer),
|
|
52
|
+
info.sampleRate,
|
|
53
|
+
info.numChannels,
|
|
54
|
+
info.samplesPerChannel
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
/** @internal */
|
|
58
|
+
protoInfo() {
|
|
59
|
+
return (0, import_protobuf.create)(import_audio_frame_pb.AudioFrameBufferInfoSchema, {
|
|
60
|
+
dataPtr: import_ffi_client.FfiClient.instance.retrievePtr(new Uint8Array(this.data.buffer)),
|
|
61
|
+
sampleRate: this.sampleRate,
|
|
62
|
+
numChannels: this.channels,
|
|
63
|
+
samplesPerChannel: this.samplesPerChannel
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const combineAudioFrames = (buffer) => {
|
|
68
|
+
if (!Array.isArray(buffer)) {
|
|
69
|
+
return buffer;
|
|
70
|
+
}
|
|
71
|
+
if (buffer.length === 0) {
|
|
72
|
+
throw new Error("buffer is empty");
|
|
73
|
+
}
|
|
74
|
+
const sampleRate = buffer[0].sampleRate;
|
|
75
|
+
const channels = buffer[0].channels;
|
|
76
|
+
let totalSamplesPerChannel = 0;
|
|
77
|
+
for (const frame of buffer) {
|
|
78
|
+
if (frame.sampleRate != sampleRate) {
|
|
79
|
+
throw new Error(`sample rate mismatch: expected ${sampleRate}, got ${frame.sampleRate}`);
|
|
80
|
+
}
|
|
81
|
+
if (frame.channels != channels) {
|
|
82
|
+
throw new Error(`channel mismatch: expected ${channels}, got ${frame.channels}`);
|
|
83
|
+
}
|
|
84
|
+
totalSamplesPerChannel += frame.samplesPerChannel;
|
|
85
|
+
}
|
|
86
|
+
const data = new Int16Array(buffer.map((x) => [...x.data]).flat());
|
|
87
|
+
return new AudioFrame(data, sampleRate, channels, totalSamplesPerChannel);
|
|
88
|
+
};
|
|
89
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
90
|
+
0 && (module.exports = {
|
|
91
|
+
AudioFrame,
|
|
92
|
+
combineAudioFrames
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=audio_frame.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/audio_frame.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { create } from '@bufbuild/protobuf';\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type { OwnedAudioFrameBuffer } from './proto/audio_frame_pb.js';\nimport { type AudioFrameBufferInfo, AudioFrameBufferInfoSchema } from './proto/audio_frame_pb.js';\n\nexport class AudioFrame {\n data: Int16Array;\n sampleRate: number;\n channels: number;\n samplesPerChannel: number;\n\n // note: if converting from Uint8Array to Int16Array, *do not* use buffer.slice!\n // it is marked unstable by Node and can cause undefined behaviour, such as massive chunks of\n // noise being added to the end.\n // it is recommended to use buffer.subarray instead.\n // XXX(nbsp): add this when writing proper docs\n constructor(data: Int16Array, sampleRate: number, channels: number, samplesPerChannel: number) {\n this.data = data;\n this.sampleRate = sampleRate;\n this.channels = channels;\n this.samplesPerChannel = samplesPerChannel;\n }\n\n static create(sampleRate: number, channels: number, samplesPerChannel: number): AudioFrame {\n const data = new Int16Array(channels * samplesPerChannel);\n return new AudioFrame(data, sampleRate, channels, samplesPerChannel);\n }\n\n /** @internal */\n static fromOwnedInfo(owned: OwnedAudioFrameBuffer): AudioFrame {\n const info = owned.info!;\n const len = info.numChannels * info.samplesPerChannel * 2; // c_int16\n const data = FfiClient.instance.copyBuffer(info.dataPtr, len);\n new FfiHandle(owned.handle!.id).dispose();\n return new AudioFrame(\n new Int16Array(data.buffer),\n info.sampleRate,\n info.numChannels,\n info.samplesPerChannel,\n );\n }\n\n /** @internal */\n protoInfo(): AudioFrameBufferInfo {\n return create(AudioFrameBufferInfoSchema, {\n dataPtr: FfiClient.instance.retrievePtr(new Uint8Array(this.data.buffer)),\n sampleRate: this.sampleRate,\n numChannels: this.channels,\n samplesPerChannel: this.samplesPerChannel,\n });\n }\n}\n\n/**\n * Combines one or more `rtc.AudioFrame` objects into a single `rtc.AudioFrame`.\n *\n * This function concatenates the audio data from multiple frames, ensuring that all frames have\n * the same sample rate and number of channels. It efficiently merges the data by preallocating the\n * necessary memory and copying the frame data without unnecessary reallocations.\n *\n * @param buffer - a single AudioFrame or list thereof\n */\nexport const combineAudioFrames = (buffer: AudioFrame | AudioFrame[]): AudioFrame => {\n if (!Array.isArray(buffer)) {\n return buffer as AudioFrame;\n }\n\n if (buffer.length === 0) {\n throw new Error('buffer is empty');\n }\n\n const sampleRate = buffer[0]!.sampleRate;\n const channels = buffer[0]!.channels;\n\n let totalSamplesPerChannel = 0;\n for (const frame of buffer) {\n if (frame.sampleRate != sampleRate) {\n throw new Error(`sample rate mismatch: expected ${sampleRate}, got ${frame.sampleRate}`);\n }\n\n if (frame.channels != channels) {\n throw new Error(`channel mismatch: expected ${channels}, got ${frame.channels}`);\n }\n\n totalSamplesPerChannel += frame.samplesPerChannel;\n }\n\n const data = new Int16Array(buffer.map((x) => [...x.data]).flat());\n return new AudioFrame(data, sampleRate, channels, totalSamplesPerChannel);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAuB;AACvB,wBAAqC;AAErC,4BAAsE;AAE/D,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWtB,YAAY,MAAkB,YAAoB,UAAkB,mBAA2B;AAC7F,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAA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,8BAA8B,QAAQ,SAAS,MAAM,QAAQ,EAAE;AAAA,IACjF;AAEA,8BAA0B,MAAM;AAAA,EAClC;AAEA,QAAM,OAAO,IAAI,WAAW,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC;AACjE,SAAO,IAAI,WAAW,MAAM,YAAY,UAAU,sBAAsB;AAC1E;","names":[]}
|
package/dist/audio_frame.js
CHANGED
|
@@ -1,72 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import { create } from "@bufbuild/protobuf";
|
|
2
|
+
import { FfiClient, FfiHandle } from "./ffi_client.js";
|
|
3
|
+
import { AudioFrameBufferInfoSchema } from "./proto/audio_frame_pb.js";
|
|
4
|
+
class AudioFrame {
|
|
5
|
+
// note: if converting from Uint8Array to Int16Array, *do not* use buffer.slice!
|
|
6
|
+
// it is marked unstable by Node and can cause undefined behaviour, such as massive chunks of
|
|
7
|
+
// noise being added to the end.
|
|
8
|
+
// it is recommended to use buffer.subarray instead.
|
|
9
|
+
// XXX(nbsp): add this when writing proper docs
|
|
10
|
+
constructor(data, sampleRate, channels, samplesPerChannel) {
|
|
11
|
+
this.data = data;
|
|
12
|
+
this.sampleRate = sampleRate;
|
|
13
|
+
this.channels = channels;
|
|
14
|
+
this.samplesPerChannel = samplesPerChannel;
|
|
15
|
+
}
|
|
16
|
+
static create(sampleRate, channels, samplesPerChannel) {
|
|
17
|
+
const data = new Int16Array(channels * samplesPerChannel);
|
|
18
|
+
return new AudioFrame(data, sampleRate, channels, samplesPerChannel);
|
|
19
|
+
}
|
|
20
|
+
/** @internal */
|
|
21
|
+
static fromOwnedInfo(owned) {
|
|
22
|
+
const info = owned.info;
|
|
23
|
+
const len = info.numChannels * info.samplesPerChannel * 2;
|
|
24
|
+
const data = FfiClient.instance.copyBuffer(info.dataPtr, len);
|
|
25
|
+
new FfiHandle(owned.handle.id).dispose();
|
|
26
|
+
return new AudioFrame(
|
|
27
|
+
new Int16Array(data.buffer),
|
|
28
|
+
info.sampleRate,
|
|
29
|
+
info.numChannels,
|
|
30
|
+
info.samplesPerChannel
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
protoInfo() {
|
|
35
|
+
return create(AudioFrameBufferInfoSchema, {
|
|
36
|
+
dataPtr: FfiClient.instance.retrievePtr(new Uint8Array(this.data.buffer)),
|
|
37
|
+
sampleRate: this.sampleRate,
|
|
38
|
+
numChannels: this.channels,
|
|
39
|
+
samplesPerChannel: this.samplesPerChannel
|
|
40
|
+
});
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (buffer.length === 0) {
|
|
55
|
-
throw new Error('buffer is empty');
|
|
43
|
+
const combineAudioFrames = (buffer) => {
|
|
44
|
+
if (!Array.isArray(buffer)) {
|
|
45
|
+
return buffer;
|
|
46
|
+
}
|
|
47
|
+
if (buffer.length === 0) {
|
|
48
|
+
throw new Error("buffer is empty");
|
|
49
|
+
}
|
|
50
|
+
const sampleRate = buffer[0].sampleRate;
|
|
51
|
+
const channels = buffer[0].channels;
|
|
52
|
+
let totalSamplesPerChannel = 0;
|
|
53
|
+
for (const frame of buffer) {
|
|
54
|
+
if (frame.sampleRate != sampleRate) {
|
|
55
|
+
throw new Error(`sample rate mismatch: expected ${sampleRate}, got ${frame.sampleRate}`);
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let totalSamplesPerChannel = 0;
|
|
60
|
-
for (const frame of buffer) {
|
|
61
|
-
if (frame.sampleRate != sampleRate) {
|
|
62
|
-
throw new Error(`sample rate mismatch: expected ${sampleRate}, got ${frame.sampleRate}`);
|
|
63
|
-
}
|
|
64
|
-
if (frame.channels != channels) {
|
|
65
|
-
throw new Error(`channel mismatch: expected ${channels}, got ${frame.channels}`);
|
|
66
|
-
}
|
|
67
|
-
totalSamplesPerChannel += frame.samplesPerChannel;
|
|
57
|
+
if (frame.channels != channels) {
|
|
58
|
+
throw new Error(`channel mismatch: expected ${channels}, got ${frame.channels}`);
|
|
68
59
|
}
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
totalSamplesPerChannel += frame.samplesPerChannel;
|
|
61
|
+
}
|
|
62
|
+
const data = new Int16Array(buffer.map((x) => [...x.data]).flat());
|
|
63
|
+
return new AudioFrame(data, sampleRate, channels, totalSamplesPerChannel);
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
AudioFrame,
|
|
67
|
+
combineAudioFrames
|
|
71
68
|
};
|
|
72
69
|
//# sourceMappingURL=audio_frame.js.map
|
package/dist/audio_frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/audio_frame.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { create } from '@bufbuild/protobuf';\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type { OwnedAudioFrameBuffer } from './proto/audio_frame_pb.js';\nimport { type AudioFrameBufferInfo, AudioFrameBufferInfoSchema } from './proto/audio_frame_pb.js';\n\nexport class AudioFrame {\n data: Int16Array;\n sampleRate: number;\n channels: number;\n samplesPerChannel: number;\n\n // note: if converting from Uint8Array to Int16Array, *do not* use buffer.slice!\n // it is marked unstable by Node and can cause undefined behaviour, such as massive chunks of\n // noise being added to the end.\n // it is recommended to use buffer.subarray instead.\n // XXX(nbsp): add this when writing proper docs\n constructor(data: Int16Array, sampleRate: number, channels: number, samplesPerChannel: number) {\n this.data = data;\n this.sampleRate = sampleRate;\n this.channels = channels;\n this.samplesPerChannel = samplesPerChannel;\n }\n\n static create(sampleRate: number, channels: number, samplesPerChannel: number): AudioFrame {\n const data = new Int16Array(channels * samplesPerChannel);\n return new AudioFrame(data, sampleRate, channels, samplesPerChannel);\n }\n\n /** @internal */\n static fromOwnedInfo(owned: OwnedAudioFrameBuffer): AudioFrame {\n const info = owned.info!;\n const len = info.numChannels * info.samplesPerChannel * 2; // c_int16\n const data = FfiClient.instance.copyBuffer(info.dataPtr, len);\n new FfiHandle(owned.handle!.id).dispose();\n return new AudioFrame(\n new Int16Array(data.buffer),\n info.sampleRate,\n info.numChannels,\n info.samplesPerChannel,\n );\n }\n\n /** @internal */\n protoInfo(): AudioFrameBufferInfo {\n return create(AudioFrameBufferInfoSchema, {\n dataPtr: FfiClient.instance.retrievePtr(new Uint8Array(this.data.buffer)),\n sampleRate: this.sampleRate,\n numChannels: this.channels,\n samplesPerChannel: this.samplesPerChannel,\n });\n }\n}\n\n/**\n * Combines one or more `rtc.AudioFrame` objects into a single `rtc.AudioFrame`.\n *\n * This function concatenates the audio data from multiple frames, ensuring that all frames have\n * the same sample rate and number of channels. It efficiently merges the data by preallocating the\n * necessary memory and copying the frame data without unnecessary reallocations.\n *\n * @param buffer - a single AudioFrame or list thereof\n */\nexport const combineAudioFrames = (buffer: AudioFrame | AudioFrame[]): AudioFrame => {\n if (!Array.isArray(buffer)) {\n return buffer as AudioFrame;\n }\n\n if (buffer.length === 0) {\n throw new Error('buffer is empty');\n }\n\n const sampleRate = buffer[0]!.sampleRate;\n const channels = buffer[0]!.channels;\n\n let totalSamplesPerChannel = 0;\n for (const frame of buffer) {\n if (frame.sampleRate != sampleRate) {\n throw new Error(`sample rate mismatch: expected ${sampleRate}, got ${frame.sampleRate}`);\n }\n\n if (frame.channels != channels) {\n throw new Error(`channel mismatch: expected ${channels}, got ${frame.channels}`);\n }\n\n totalSamplesPerChannel += frame.samplesPerChannel;\n }\n\n const data = new Int16Array(buffer.map((x) => [...x.data]).flat());\n return new AudioFrame(data, sampleRate, channels, totalSamplesPerChannel);\n};\n"],"mappings":"AAGA,SAAS,cAAc;AACvB,SAAS,WAAW,iBAAiB;AAErC,SAAoC,kCAAkC;AAE/D,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWtB,YAAY,MAAkB,YAAoB,UAAkB,mBAA2B;AAC7F,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAAK,WAAW;AAChB,SAAK,oBAAoB;AAAA,EAC3B;AAAA,EAEA,OAAO,OAAO,YAAoB,UAAkB,mBAAuC;AACzF,UAAM,OAAO,IAAI,WAAW,WAAW,iBAAiB;AACxD,WAAO,IAAI,WAAW,MAAM,YAAY,UAAU,iBAAiB;AAAA,EACrE;AAAA;AAAA,EAGA,OAAO,cAAc,OAA0C;AAC7D,UAAM,OAAO,MAAM;AACnB,UAAM,MAAM,KAAK,cAAc,KAAK,oBAAoB;AACxD,UAAM,OAAO,UAAU,SAAS,WAAW,KAAK,SAAS,GAAG;AAC5D,QAAI,UAAU,MAAM,OAAQ,EAAE,EAAE,QAAQ;AACxC,WAAO,IAAI;AAAA,MACT,IAAI,WAAW,KAAK,MAAM;AAAA,MAC1B,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AAAA;AAAA,EAGA,YAAkC;AAChC,WAAO,OAAO,4BAA4B;AAAA,MACxC,SAAS,UAAU,SAAS,YAAY,IAAI,WAAW,KAAK,KAAK,MAAM,CAAC;AAAA,MACxE,YAAY,KAAK;AAAA,MACjB,aAAa,KAAK;AAAA,MAClB,mBAAmB,KAAK;AAAA,IAC1B,CAAC;AAAA,EACH;AACF;AAWO,MAAM,qBAAqB,CAAC,WAAkD;AACnF,MAAI,CAAC,MAAM,QAAQ,MAAM,GAAG;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,GAAG;AACvB,UAAM,IAAI,MAAM,iBAAiB;AAAA,EACnC;AAEA,QAAM,aAAa,OAAO,CAAC,EAAG;AAC9B,QAAM,WAAW,OAAO,CAAC,EAAG;AAE5B,MAAI,yBAAyB;AAC7B,aAAW,SAAS,QAAQ;AAC1B,QAAI,MAAM,cAAc,YAAY;AAClC,YAAM,IAAI,MAAM,kCAAkC,UAAU,SAAS,MAAM,UAAU,EAAE;AAAA,IACzF;AAEA,QAAI,MAAM,YAAY,UAAU;AAC9B,YAAM,IAAI,MAAM,8BAA8B,QAAQ,SAAS,MAAM,QAAQ,EAAE;AAAA,IACjF;AAEA,8BAA0B,MAAM;AAAA,EAClC;AAEA,QAAM,OAAO,IAAI,WAAW,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC;AACjE,SAAO,IAAI,WAAW,MAAM,YAAY,UAAU,sBAAsB;AAC1E;","names":[]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var audio_resampler_exports = {};
|
|
20
|
+
__export(audio_resampler_exports, {
|
|
21
|
+
AudioResampler: () => AudioResampler,
|
|
22
|
+
AudioResamplerQuality: () => AudioResamplerQuality
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(audio_resampler_exports);
|
|
25
|
+
var import_protobuf = require("@bufbuild/protobuf");
|
|
26
|
+
var import_audio_frame = require("./audio_frame.cjs");
|
|
27
|
+
var import_ffi_client = require("./ffi_client.cjs");
|
|
28
|
+
var import_audio_frame_pb = require("./proto/audio_frame_pb.cjs");
|
|
29
|
+
var AudioResamplerQuality = ((AudioResamplerQuality2) => {
|
|
30
|
+
AudioResamplerQuality2[AudioResamplerQuality2["QUICK"] = import_audio_frame_pb.SoxQualityRecipe.SOXR_QUALITY_QUICK] = "QUICK";
|
|
31
|
+
AudioResamplerQuality2[AudioResamplerQuality2["LOW"] = import_audio_frame_pb.SoxQualityRecipe.SOXR_QUALITY_LOW] = "LOW";
|
|
32
|
+
AudioResamplerQuality2[AudioResamplerQuality2["MEDIUM"] = import_audio_frame_pb.SoxQualityRecipe.SOXR_QUALITY_MEDIUM] = "MEDIUM";
|
|
33
|
+
AudioResamplerQuality2[AudioResamplerQuality2["HIGH"] = import_audio_frame_pb.SoxQualityRecipe.SOXR_QUALITY_HIGH] = "HIGH";
|
|
34
|
+
AudioResamplerQuality2[AudioResamplerQuality2["VERY_HIGH"] = import_audio_frame_pb.SoxQualityRecipe.SOXR_QUALITY_VERYHIGH] = "VERY_HIGH";
|
|
35
|
+
return AudioResamplerQuality2;
|
|
36
|
+
})(AudioResamplerQuality || {});
|
|
37
|
+
class AudioResampler {
|
|
38
|
+
#inputRate;
|
|
39
|
+
#outputRate;
|
|
40
|
+
#channels;
|
|
41
|
+
#ffiHandle;
|
|
42
|
+
/**
|
|
43
|
+
* Initializes a new AudioResampler.
|
|
44
|
+
*
|
|
45
|
+
* @param inputRate - The sample rate of the input audio data (in Hz).
|
|
46
|
+
* @param outputRate - The desired sample rate of the output audio data (in Hz).
|
|
47
|
+
* @param channels - The number of audio channels (e.g., 1 for mono, 2 for stereo). Defaults to 1.
|
|
48
|
+
* @param quality - The quality setting for the resampler. Defaults to
|
|
49
|
+
* `AudioResamplerQuality.MEDIUM`.
|
|
50
|
+
*/
|
|
51
|
+
constructor(inputRate, outputRate, channels = 1, quality = AudioResamplerQuality.MEDIUM) {
|
|
52
|
+
this.#inputRate = inputRate;
|
|
53
|
+
this.#outputRate = outputRate;
|
|
54
|
+
this.#channels = channels;
|
|
55
|
+
const req = (0, import_protobuf.create)(import_audio_frame_pb.NewSoxResamplerRequestSchema, {
|
|
56
|
+
inputRate,
|
|
57
|
+
outputRate,
|
|
58
|
+
numChannels: channels,
|
|
59
|
+
qualityRecipe: quality,
|
|
60
|
+
inputDataType: import_audio_frame_pb.SoxResamplerDataType.SOXR_DATATYPE_INT16I,
|
|
61
|
+
outputDataType: import_audio_frame_pb.SoxResamplerDataType.SOXR_DATATYPE_INT16I,
|
|
62
|
+
flags: 0
|
|
63
|
+
});
|
|
64
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
65
|
+
message: {
|
|
66
|
+
case: "newSoxResampler",
|
|
67
|
+
value: req
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
if (res.message.case !== "resampler") {
|
|
71
|
+
throw new Error(res.message.value ?? "Unknown Error");
|
|
72
|
+
}
|
|
73
|
+
this.#ffiHandle = new import_ffi_client.FfiHandle(res.message.value.handle.id);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Push audio data into the resampler and retrieve any available resampled data.
|
|
77
|
+
*
|
|
78
|
+
* This method accepts audio data, resamples it according to the configured input and output rates,
|
|
79
|
+
* and returns any resampled data that is available after processing the input.
|
|
80
|
+
*
|
|
81
|
+
* @param data - The audio frame to resample
|
|
82
|
+
*
|
|
83
|
+
* @returns A list of {@link AudioFrame} objects containing the resampled audio data. The list may
|
|
84
|
+
* be empty if no output data is available yet.
|
|
85
|
+
*/
|
|
86
|
+
push(data) {
|
|
87
|
+
const req = (0, import_protobuf.create)(import_audio_frame_pb.PushSoxResamplerRequestSchema, {
|
|
88
|
+
resamplerHandle: this.#ffiHandle.handle,
|
|
89
|
+
dataPtr: data.protoInfo().dataPtr,
|
|
90
|
+
size: data.data.byteLength
|
|
91
|
+
});
|
|
92
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
93
|
+
message: {
|
|
94
|
+
case: "pushSoxResampler",
|
|
95
|
+
value: req
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
if (res.error) {
|
|
99
|
+
throw new Error(res.error);
|
|
100
|
+
}
|
|
101
|
+
if (!res.outputPtr) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const outputData = import_ffi_client.FfiClient.instance.copyBuffer(res.outputPtr, res.size);
|
|
105
|
+
return [
|
|
106
|
+
new import_audio_frame.AudioFrame(
|
|
107
|
+
new Int16Array(outputData.buffer),
|
|
108
|
+
this.#outputRate,
|
|
109
|
+
this.#channels,
|
|
110
|
+
Math.trunc(outputData.length / this.#channels / 2)
|
|
111
|
+
)
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Flush any remaining audio data through the resampler and retrieve the resampled data.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* This method should be called when no more input data will be provided to ensure that all
|
|
119
|
+
* internal buffers are processed and all resampled data is output.
|
|
120
|
+
*/
|
|
121
|
+
flush() {
|
|
122
|
+
const req = (0, import_protobuf.create)(import_audio_frame_pb.FlushSoxResamplerRequestSchema, {
|
|
123
|
+
resamplerHandle: this.#ffiHandle.handle
|
|
124
|
+
});
|
|
125
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
126
|
+
message: {
|
|
127
|
+
case: "flushSoxResampler",
|
|
128
|
+
value: req
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
if (res.error) {
|
|
132
|
+
throw new Error(res.error);
|
|
133
|
+
}
|
|
134
|
+
if (!res.outputPtr) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
const outputData = import_ffi_client.FfiClient.instance.copyBuffer(res.outputPtr, res.size);
|
|
138
|
+
return [
|
|
139
|
+
new import_audio_frame.AudioFrame(
|
|
140
|
+
new Int16Array(outputData.buffer),
|
|
141
|
+
this.#outputRate,
|
|
142
|
+
this.#channels,
|
|
143
|
+
Math.trunc(outputData.length / this.#channels / 2)
|
|
144
|
+
)
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
149
|
+
0 && (module.exports = {
|
|
150
|
+
AudioResampler,
|
|
151
|
+
AudioResamplerQuality
|
|
152
|
+
});
|
|
153
|
+
//# sourceMappingURL=audio_resampler.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/audio_resampler.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { create } from '@bufbuild/protobuf';\nimport { AudioFrame } from './audio_frame.js';\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type {\n FlushSoxResamplerResponse,\n NewSoxResamplerResponse,\n PushSoxResamplerResponse,\n} from './proto/audio_frame_pb.js';\nimport {\n FlushSoxResamplerRequestSchema,\n NewSoxResamplerRequestSchema,\n PushSoxResamplerRequestSchema,\n SoxQualityRecipe,\n SoxResamplerDataType,\n} from './proto/audio_frame_pb.js';\n\n/**\n * Resampler quality. Higher quality settings result in better audio quality but require more\n * processing power.\n */\nexport enum AudioResamplerQuality {\n QUICK = SoxQualityRecipe.SOXR_QUALITY_QUICK,\n LOW = SoxQualityRecipe.SOXR_QUALITY_LOW,\n MEDIUM = SoxQualityRecipe.SOXR_QUALITY_MEDIUM,\n HIGH = SoxQualityRecipe.SOXR_QUALITY_HIGH,\n VERY_HIGH = SoxQualityRecipe.SOXR_QUALITY_VERYHIGH,\n}\n\n/**\n * AudioResampler provides functionality to resample audio data from an input sample rate to\n * an output sample rate using the Sox resampling library. It supports multiple channels and\n * configurable resampling quality.\n */\nexport class AudioResampler {\n #inputRate: number;\n #outputRate: number;\n #channels: number;\n #ffiHandle: FfiHandle;\n\n /**\n * Initializes a new AudioResampler.\n *\n * @param inputRate - The sample rate of the input audio data (in Hz).\n * @param outputRate - The desired sample rate of the output audio data (in Hz).\n * @param channels - The number of audio channels (e.g., 1 for mono, 2 for stereo). Defaults to 1.\n * @param quality - The quality setting for the resampler. Defaults to\n * `AudioResamplerQuality.MEDIUM`.\n */\n constructor(\n inputRate: number,\n outputRate: number,\n channels = 1,\n quality = AudioResamplerQuality.MEDIUM,\n ) {\n this.#inputRate = inputRate;\n this.#outputRate = outputRate;\n this.#channels = channels;\n\n const req = create(NewSoxResamplerRequestSchema, {\n inputRate,\n outputRate,\n numChannels: channels,\n qualityRecipe: quality as number as SoxQualityRecipe,\n inputDataType: SoxResamplerDataType.SOXR_DATATYPE_INT16I,\n outputDataType: SoxResamplerDataType.SOXR_DATATYPE_INT16I,\n flags: 0,\n });\n\n const res = FfiClient.instance.request<NewSoxResamplerResponse>({\n message: {\n case: 'newSoxResampler',\n value: req,\n },\n });\n\n if (res.message.case !== 'resampler') {\n throw new Error(res.message.value ?? 'Unknown Error');\n }\n\n this.#ffiHandle = new FfiHandle(res.message.value.handle!.id);\n }\n\n /**\n * Push audio data into the resampler and retrieve any available resampled data.\n *\n * This method accepts audio data, resamples it according to the configured input and output rates,\n * and returns any resampled data that is available after processing the input.\n *\n * @param data - The audio frame to resample\n *\n * @returns A list of {@link AudioFrame} objects containing the resampled audio data. The list may\n * be empty if no output data is available yet.\n */\n push(data: AudioFrame): AudioFrame[] {\n const req = create(PushSoxResamplerRequestSchema, {\n resamplerHandle: this.#ffiHandle.handle,\n dataPtr: data.protoInfo().dataPtr,\n size: data.data.byteLength,\n });\n\n const res = FfiClient.instance.request<PushSoxResamplerResponse>({\n message: {\n case: 'pushSoxResampler',\n value: req,\n },\n });\n\n if (res.error) {\n throw new Error(res.error);\n }\n\n if (!res.outputPtr) {\n return [];\n }\n\n const outputData = FfiClient.instance.copyBuffer(res.outputPtr, res.size);\n return [\n new AudioFrame(\n new Int16Array(outputData.buffer),\n this.#outputRate,\n this.#channels,\n Math.trunc(outputData.length / this.#channels / 2),\n ),\n ];\n }\n\n /**\n * Flush any remaining audio data through the resampler and retrieve the resampled data.\n *\n * @remarks\n * This method should be called when no more input data will be provided to ensure that all\n * internal buffers are processed and all resampled data is output.\n */\n flush(): AudioFrame[] {\n const req = create(FlushSoxResamplerRequestSchema, {\n resamplerHandle: this.#ffiHandle.handle,\n });\n\n const res = FfiClient.instance.request<FlushSoxResamplerResponse>({\n message: {\n case: 'flushSoxResampler',\n value: req,\n },\n });\n\n if (res.error) {\n throw new Error(res.error);\n }\n\n if (!res.outputPtr) {\n return [];\n }\n\n const outputData = FfiClient.instance.copyBuffer(res.outputPtr, res.size);\n return [\n new AudioFrame(\n new Int16Array(outputData.buffer),\n this.#outputRate,\n this.#channels,\n Math.trunc(outputData.length / this.#channels / 2),\n ),\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAuB;AACvB,yBAA2B;AAC3B,wBAAqC;AAMrC,4BAMO;AAMA,IAAK,yBAAL,CAAKA,2BAAL;AACL,EAAAA,8CAAA,WAAQ,uCAAiB,sBAAzB;AACA,EA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