@livekit/rtc-node 0.13.21 → 0.13.23
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/async_queue.cjs +80 -0
- package/dist/async_queue.cjs.map +1 -0
- package/dist/async_queue.d.cts +30 -0
- package/dist/async_queue.d.ts +30 -0
- package/dist/async_queue.d.ts.map +1 -0
- package/dist/async_queue.js +56 -0
- package/dist/async_queue.js.map +1 -0
- package/dist/audio_frame.cjs +5 -0
- package/dist/audio_frame.cjs.map +1 -1
- package/dist/audio_frame.d.cts +3 -0
- package/dist/audio_frame.d.ts +3 -0
- package/dist/audio_frame.d.ts.map +1 -1
- package/dist/audio_frame.js +5 -0
- package/dist/audio_frame.js.map +1 -1
- package/dist/audio_mixer.cjs +281 -0
- package/dist/audio_mixer.cjs.map +1 -0
- package/dist/audio_mixer.d.cts +121 -0
- package/dist/audio_mixer.d.ts +121 -0
- package/dist/audio_mixer.d.ts.map +1 -0
- package/dist/audio_mixer.js +256 -0
- package/dist/audio_mixer.js.map +1 -0
- package/dist/audio_stream.cjs +18 -5
- package/dist/audio_stream.cjs.map +1 -1
- package/dist/audio_stream.d.cts +4 -3
- package/dist/audio_stream.d.ts +4 -3
- package/dist/audio_stream.d.ts.map +1 -1
- package/dist/audio_stream.js +18 -5
- package/dist/audio_stream.js.map +1 -1
- package/dist/data_streams/stream_reader.cjs.map +1 -1
- package/dist/data_streams/stream_reader.js.map +1 -1
- package/dist/frame_processor.cjs +38 -0
- package/dist/frame_processor.cjs.map +1 -0
- package/dist/frame_processor.d.cts +29 -0
- package/dist/frame_processor.d.ts +29 -0
- package/dist/frame_processor.d.ts.map +1 -0
- package/dist/frame_processor.js +14 -0
- package/dist/frame_processor.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/participant.cjs +4 -4
- package/dist/participant.cjs.map +1 -1
- package/dist/participant.d.cts +2 -2
- package/dist/participant.d.ts +2 -2
- package/dist/participant.d.ts.map +1 -1
- package/dist/participant.js +4 -4
- package/dist/participant.js.map +1 -1
- package/dist/proto/audio_frame_pb.cjs.map +1 -1
- package/dist/proto/audio_frame_pb.js.map +1 -1
- package/dist/proto/e2ee_pb.cjs.map +1 -1
- package/dist/proto/e2ee_pb.js.map +1 -1
- package/dist/proto/ffi_pb.cjs +4 -2
- package/dist/proto/ffi_pb.cjs.map +1 -1
- package/dist/proto/ffi_pb.d.cts +13 -1
- package/dist/proto/ffi_pb.d.ts +13 -1
- package/dist/proto/ffi_pb.d.ts.map +1 -1
- package/dist/proto/ffi_pb.js +5 -3
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/proto/handle_pb.cjs.map +1 -1
- package/dist/proto/handle_pb.js.map +1 -1
- package/dist/proto/participant_pb.cjs +26 -4
- package/dist/proto/participant_pb.cjs.map +1 -1
- package/dist/proto/participant_pb.d.cts +31 -2
- package/dist/proto/participant_pb.d.ts +31 -2
- package/dist/proto/participant_pb.d.ts.map +1 -1
- package/dist/proto/participant_pb.js +24 -3
- package/dist/proto/participant_pb.js.map +1 -1
- package/dist/proto/room_pb.cjs +29 -2
- package/dist/proto/room_pb.cjs.map +1 -1
- package/dist/proto/room_pb.d.cts +30 -7
- package/dist/proto/room_pb.d.ts +30 -7
- package/dist/proto/room_pb.d.ts.map +1 -1
- package/dist/proto/room_pb.js +28 -2
- package/dist/proto/room_pb.js.map +1 -1
- package/dist/proto/rpc_pb.cjs.map +1 -1
- package/dist/proto/rpc_pb.js.map +1 -1
- package/dist/proto/stats_pb.cjs.map +1 -1
- package/dist/proto/stats_pb.js.map +1 -1
- package/dist/proto/track_pb.cjs.map +1 -1
- package/dist/proto/track_pb.js.map +1 -1
- package/dist/proto/track_publication_pb.cjs +66 -2
- package/dist/proto/track_publication_pb.cjs.map +1 -1
- package/dist/proto/track_publication_pb.d.cts +56 -1
- package/dist/proto/track_publication_pb.d.ts +56 -1
- package/dist/proto/track_publication_pb.d.ts.map +1 -1
- package/dist/proto/track_publication_pb.js +62 -1
- package/dist/proto/track_publication_pb.js.map +1 -1
- package/dist/proto/video_frame_pb.cjs +3 -1
- package/dist/proto/video_frame_pb.cjs.map +1 -1
- package/dist/proto/video_frame_pb.d.cts +5 -1
- package/dist/proto/video_frame_pb.d.ts +5 -1
- package/dist/proto/video_frame_pb.d.ts.map +1 -1
- package/dist/proto/video_frame_pb.js +3 -1
- package/dist/proto/video_frame_pb.js.map +1 -1
- package/dist/room.cjs +286 -288
- package/dist/room.cjs.map +1 -1
- package/dist/room.d.cts +11 -11
- package/dist/room.d.ts +11 -11
- package/dist/room.d.ts.map +1 -1
- package/dist/room.js +287 -289
- package/dist/room.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +9 -8
- package/src/async_queue.test.ts +250 -0
- package/src/async_queue.ts +80 -0
- package/src/audio_frame.ts +7 -0
- package/src/audio_mixer.test.ts +167 -0
- package/src/audio_mixer.ts +407 -0
- package/src/audio_stream.ts +22 -7
- package/src/data_streams/stream_reader.ts +4 -4
- package/src/frame_processor.ts +29 -0
- package/src/index.ts +6 -0
- package/src/participant.ts +5 -5
- package/src/proto/audio_frame_pb.ts +1 -1
- package/src/proto/e2ee_pb.ts +1 -1
- package/src/proto/ffi_pb.ts +16 -2
- package/src/proto/handle_pb.ts +1 -1
- package/src/proto/participant_pb.ts +45 -1
- package/src/proto/room_pb.ts +52 -8
- package/src/proto/rpc_pb.ts +1 -1
- package/src/proto/stats_pb.ts +1 -1
- package/src/proto/track_pb.ts +1 -1
- package/src/proto/track_publication_pb.ts +105 -1
- package/src/proto/video_frame_pb.ts +7 -1
- package/src/room.ts +297 -300
- package/src/version.ts +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
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 async_queue_exports = {};
|
|
20
|
+
__export(async_queue_exports, {
|
|
21
|
+
AsyncQueue: () => AsyncQueue
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(async_queue_exports);
|
|
24
|
+
var import_deque = require("@datastructures-js/deque");
|
|
25
|
+
class AsyncQueue {
|
|
26
|
+
constructor(capacity = Infinity) {
|
|
27
|
+
this.capacity = capacity;
|
|
28
|
+
this.items = [];
|
|
29
|
+
this.waitingProducers = new import_deque.Deque();
|
|
30
|
+
this.waitingConsumers = new import_deque.Deque();
|
|
31
|
+
this.closed = false;
|
|
32
|
+
}
|
|
33
|
+
async put(item) {
|
|
34
|
+
if (this.closed) throw new Error("Queue closed");
|
|
35
|
+
while (this.items.length >= this.capacity) {
|
|
36
|
+
await new Promise(
|
|
37
|
+
(resolve, reject) => this.waitingProducers.pushBack({ resolve, reject })
|
|
38
|
+
);
|
|
39
|
+
if (this.closed) throw new Error("Queue closed");
|
|
40
|
+
}
|
|
41
|
+
this.items.push(item);
|
|
42
|
+
if (this.waitingConsumers.size() > 0) {
|
|
43
|
+
const resolve = this.waitingConsumers.popFront();
|
|
44
|
+
resolve();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
get() {
|
|
48
|
+
const item = this.items.shift();
|
|
49
|
+
if (this.waitingProducers.size() > 0) {
|
|
50
|
+
const producer = this.waitingProducers.popFront();
|
|
51
|
+
producer.resolve();
|
|
52
|
+
}
|
|
53
|
+
return item;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Wait until an item is available or the queue is closed.
|
|
57
|
+
* Returns immediately if items are already available.
|
|
58
|
+
*/
|
|
59
|
+
async waitForItem() {
|
|
60
|
+
if (this.items.length > 0 || this.closed) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
await new Promise((resolve) => this.waitingConsumers.pushBack(resolve));
|
|
64
|
+
}
|
|
65
|
+
close() {
|
|
66
|
+
this.closed = true;
|
|
67
|
+
this.waitingProducers.toArray().forEach((producer) => producer.reject(new Error("Queue closed")));
|
|
68
|
+
this.waitingConsumers.toArray().forEach((resolve) => resolve());
|
|
69
|
+
this.waitingProducers.clear();
|
|
70
|
+
this.waitingConsumers.clear();
|
|
71
|
+
}
|
|
72
|
+
get length() {
|
|
73
|
+
return this.items.length;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
AsyncQueue
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=async_queue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/async_queue.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Deque } from '@datastructures-js/deque';\n\n/**\n * AsyncQueue is a bounded queue with async support for both producers and consumers.\n *\n * This queue simplifies the AudioMixer implementation by handling backpressure and\n * synchronization automatically:\n * - Producers can await put() until the queue has space (when queue is full)\n * - Consumers can await waitForItem() until data is available (when queue is empty)\n *\n * This eliminates the need for manual coordination logic, polling loops, and\n * complex state management throughout the rest of the codebase.\n */\nexport class AsyncQueue<T> {\n private items: T[] = [];\n private waitingProducers = new Deque<{ resolve: () => void; reject: (err: Error) => void }>();\n private waitingConsumers = new Deque<() => void>();\n closed = false;\n\n constructor(private capacity: number = Infinity) {}\n\n async put(item: T) {\n if (this.closed) throw new Error('Queue closed');\n\n while (this.items.length >= this.capacity) {\n await new Promise<void>((resolve, reject) =>\n this.waitingProducers.pushBack({ resolve, reject }),\n );\n // Re-check if closed after waking up\n if (this.closed) throw new Error('Queue closed');\n }\n\n this.items.push(item);\n\n // Wake up one waiting consumer\n if (this.waitingConsumers.size() > 0) {\n const resolve = this.waitingConsumers.popFront()!;\n resolve();\n }\n }\n\n get(): T | undefined {\n const item = this.items.shift();\n if (this.waitingProducers.size() > 0) {\n const producer = this.waitingProducers.popFront()!;\n producer.resolve(); // wakes up one waiting producer\n }\n return item;\n }\n\n /**\n * Wait until an item is available or the queue is closed.\n * Returns immediately if items are already available.\n */\n async waitForItem(): Promise<void> {\n if (this.items.length > 0 || this.closed) {\n return;\n }\n await new Promise<void>((resolve) => this.waitingConsumers.pushBack(resolve));\n }\n\n close() {\n this.closed = true;\n // Reject all waiting producers with an error\n this.waitingProducers\n .toArray()\n .forEach((producer) => producer.reject(new Error('Queue closed')));\n // Resolve all waiting consumers so they can see the queue is closed\n this.waitingConsumers.toArray().forEach((resolve) => resolve());\n this.waitingProducers.clear();\n this.waitingConsumers.clear();\n }\n\n get length() {\n return this.items.length;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAsB;AAaf,MAAM,WAAc;AAAA,EAMzB,YAAoB,WAAmB,UAAU;AAA7B;AALpB,SAAQ,QAAa,CAA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K,MAAM;AAAA,EACpB;AACF;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsyncQueue is a bounded queue with async support for both producers and consumers.
|
|
3
|
+
*
|
|
4
|
+
* This queue simplifies the AudioMixer implementation by handling backpressure and
|
|
5
|
+
* synchronization automatically:
|
|
6
|
+
* - Producers can await put() until the queue has space (when queue is full)
|
|
7
|
+
* - Consumers can await waitForItem() until data is available (when queue is empty)
|
|
8
|
+
*
|
|
9
|
+
* This eliminates the need for manual coordination logic, polling loops, and
|
|
10
|
+
* complex state management throughout the rest of the codebase.
|
|
11
|
+
*/
|
|
12
|
+
declare class AsyncQueue<T> {
|
|
13
|
+
private capacity;
|
|
14
|
+
private items;
|
|
15
|
+
private waitingProducers;
|
|
16
|
+
private waitingConsumers;
|
|
17
|
+
closed: boolean;
|
|
18
|
+
constructor(capacity?: number);
|
|
19
|
+
put(item: T): Promise<void>;
|
|
20
|
+
get(): T | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Wait until an item is available or the queue is closed.
|
|
23
|
+
* Returns immediately if items are already available.
|
|
24
|
+
*/
|
|
25
|
+
waitForItem(): Promise<void>;
|
|
26
|
+
close(): void;
|
|
27
|
+
get length(): number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { AsyncQueue };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsyncQueue is a bounded queue with async support for both producers and consumers.
|
|
3
|
+
*
|
|
4
|
+
* This queue simplifies the AudioMixer implementation by handling backpressure and
|
|
5
|
+
* synchronization automatically:
|
|
6
|
+
* - Producers can await put() until the queue has space (when queue is full)
|
|
7
|
+
* - Consumers can await waitForItem() until data is available (when queue is empty)
|
|
8
|
+
*
|
|
9
|
+
* This eliminates the need for manual coordination logic, polling loops, and
|
|
10
|
+
* complex state management throughout the rest of the codebase.
|
|
11
|
+
*/
|
|
12
|
+
declare class AsyncQueue<T> {
|
|
13
|
+
private capacity;
|
|
14
|
+
private items;
|
|
15
|
+
private waitingProducers;
|
|
16
|
+
private waitingConsumers;
|
|
17
|
+
closed: boolean;
|
|
18
|
+
constructor(capacity?: number);
|
|
19
|
+
put(item: T): Promise<void>;
|
|
20
|
+
get(): T | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Wait until an item is available or the queue is closed.
|
|
23
|
+
* Returns immediately if items are already available.
|
|
24
|
+
*/
|
|
25
|
+
waitForItem(): Promise<void>;
|
|
26
|
+
close(): void;
|
|
27
|
+
get length(): number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { AsyncQueue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async_queue.d.ts","sourceRoot":"","sources":["../src/async_queue.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,qBAAa,UAAU,CAAC,CAAC;IAMX,OAAO,CAAC,QAAQ;IAL5B,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,gBAAgB,CAAsE;IAC9F,OAAO,CAAC,gBAAgB,CAA2B;IACnD,MAAM,UAAS;gBAEK,QAAQ,GAAE,MAAiB;IAEzC,GAAG,CAAC,IAAI,EAAE,CAAC;IAoBjB,GAAG,IAAI,CAAC,GAAG,SAAS;IASpB;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAOlC,KAAK;IAYL,IAAI,MAAM,WAET;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Deque } from "@datastructures-js/deque";
|
|
2
|
+
class AsyncQueue {
|
|
3
|
+
constructor(capacity = Infinity) {
|
|
4
|
+
this.capacity = capacity;
|
|
5
|
+
this.items = [];
|
|
6
|
+
this.waitingProducers = new Deque();
|
|
7
|
+
this.waitingConsumers = new Deque();
|
|
8
|
+
this.closed = false;
|
|
9
|
+
}
|
|
10
|
+
async put(item) {
|
|
11
|
+
if (this.closed) throw new Error("Queue closed");
|
|
12
|
+
while (this.items.length >= this.capacity) {
|
|
13
|
+
await new Promise(
|
|
14
|
+
(resolve, reject) => this.waitingProducers.pushBack({ resolve, reject })
|
|
15
|
+
);
|
|
16
|
+
if (this.closed) throw new Error("Queue closed");
|
|
17
|
+
}
|
|
18
|
+
this.items.push(item);
|
|
19
|
+
if (this.waitingConsumers.size() > 0) {
|
|
20
|
+
const resolve = this.waitingConsumers.popFront();
|
|
21
|
+
resolve();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
get() {
|
|
25
|
+
const item = this.items.shift();
|
|
26
|
+
if (this.waitingProducers.size() > 0) {
|
|
27
|
+
const producer = this.waitingProducers.popFront();
|
|
28
|
+
producer.resolve();
|
|
29
|
+
}
|
|
30
|
+
return item;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Wait until an item is available or the queue is closed.
|
|
34
|
+
* Returns immediately if items are already available.
|
|
35
|
+
*/
|
|
36
|
+
async waitForItem() {
|
|
37
|
+
if (this.items.length > 0 || this.closed) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
await new Promise((resolve) => this.waitingConsumers.pushBack(resolve));
|
|
41
|
+
}
|
|
42
|
+
close() {
|
|
43
|
+
this.closed = true;
|
|
44
|
+
this.waitingProducers.toArray().forEach((producer) => producer.reject(new Error("Queue closed")));
|
|
45
|
+
this.waitingConsumers.toArray().forEach((resolve) => resolve());
|
|
46
|
+
this.waitingProducers.clear();
|
|
47
|
+
this.waitingConsumers.clear();
|
|
48
|
+
}
|
|
49
|
+
get length() {
|
|
50
|
+
return this.items.length;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
AsyncQueue
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=async_queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/async_queue.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Deque } from '@datastructures-js/deque';\n\n/**\n * AsyncQueue is a bounded queue with async support for both producers and consumers.\n *\n * This queue simplifies the AudioMixer implementation by handling backpressure and\n * synchronization automatically:\n * - Producers can await put() until the queue has space (when queue is full)\n * - Consumers can await waitForItem() until data is available (when queue is empty)\n *\n * This eliminates the need for manual coordination logic, polling loops, and\n * complex state management throughout the rest of the codebase.\n */\nexport class AsyncQueue<T> {\n private items: T[] = [];\n private waitingProducers = new Deque<{ resolve: () => void; reject: (err: Error) => void }>();\n private waitingConsumers = new Deque<() => void>();\n closed = false;\n\n constructor(private capacity: number = Infinity) {}\n\n async put(item: T) {\n if (this.closed) throw new Error('Queue closed');\n\n while (this.items.length >= this.capacity) {\n await new Promise<void>((resolve, reject) =>\n this.waitingProducers.pushBack({ resolve, reject }),\n );\n // Re-check if closed after waking up\n if (this.closed) throw new Error('Queue closed');\n }\n\n this.items.push(item);\n\n // Wake up one waiting consumer\n if (this.waitingConsumers.size() > 0) {\n const resolve = this.waitingConsumers.popFront()!;\n resolve();\n }\n }\n\n get(): T | undefined {\n const item = this.items.shift();\n if (this.waitingProducers.size() > 0) {\n const producer = this.waitingProducers.popFront()!;\n producer.resolve(); // wakes up one waiting producer\n }\n return item;\n }\n\n /**\n * Wait until an item is available or the queue is closed.\n * Returns immediately if items are already available.\n */\n async waitForItem(): Promise<void> {\n if (this.items.length > 0 || this.closed) {\n return;\n }\n await new Promise<void>((resolve) => this.waitingConsumers.pushBack(resolve));\n }\n\n close() {\n this.closed = true;\n // Reject all waiting producers with an error\n this.waitingProducers\n .toArray()\n .forEach((producer) => producer.reject(new Error('Queue closed')));\n // Resolve all waiting consumers so they can see the queue is closed\n this.waitingConsumers.toArray().forEach((resolve) => resolve());\n this.waitingProducers.clear();\n this.waitingConsumers.clear();\n }\n\n get length() {\n return this.items.length;\n }\n}\n"],"mappings":"AAGA,SAAS,aAAa;AAaf,MAAM,WAAc;AAAA,EAMzB,YAAoB,WAAmB,UAAU;AAA7B;AALpB,SAAQ,QAAa,CAAC;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AM;AAAA,EACpB;AACF;","names":[]}
|
package/dist/audio_frame.cjs
CHANGED
|
@@ -31,6 +31,7 @@ class AudioFrame {
|
|
|
31
31
|
// it is recommended to use buffer.subarray instead.
|
|
32
32
|
// XXX(nbsp): add this when writing proper docs
|
|
33
33
|
constructor(data, sampleRate, channels, samplesPerChannel) {
|
|
34
|
+
this._userdata = {};
|
|
34
35
|
this.data = data;
|
|
35
36
|
this.sampleRate = sampleRate;
|
|
36
37
|
this.channels = channels;
|
|
@@ -62,6 +63,10 @@ class AudioFrame {
|
|
|
62
63
|
samplesPerChannel: this.samplesPerChannel
|
|
63
64
|
});
|
|
64
65
|
}
|
|
66
|
+
/** Returns the user data associated with the audio frame. */
|
|
67
|
+
get userdata() {
|
|
68
|
+
return this._userdata;
|
|
69
|
+
}
|
|
65
70
|
}
|
|
66
71
|
const combineAudioFrames = (buffer) => {
|
|
67
72
|
if (!Array.isArray(buffer)) {
|
package/dist/audio_frame.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/audio_frame.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type { OwnedAudioFrameBuffer } from './proto/audio_frame_pb.js';\nimport { AudioFrameBufferInfo } 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 new AudioFrameBufferInfo({\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;\n }\n buffer = buffer as AudioFrame[];\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,wBAAqC;AAErC,4BAAqC;AAE9B,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/audio_frame.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type { OwnedAudioFrameBuffer } from './proto/audio_frame_pb.js';\nimport { AudioFrameBufferInfo } from './proto/audio_frame_pb.js';\n\nexport class AudioFrame {\n data: Int16Array;\n sampleRate: number;\n channels: number;\n samplesPerChannel: number;\n\n private _userdata: Record<string, unknown> = {};\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 new AudioFrameBufferInfo({\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 /** Returns the user data associated with the audio frame. */\n get userdata() {\n return this._userdata;\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;\n }\n buffer = buffer as AudioFrame[];\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,wBAAqC;AAErC,4BAAqC;AAE9B,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAatB,YAAY,MAAkB,YAAoB,UAAkB,mBAA2B;AAP/F,SAAQ,YAAqC,CAAC;AAQ5C,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,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AO,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.d.cts
CHANGED
|
@@ -10,12 +10,15 @@ declare class AudioFrame {
|
|
|
10
10
|
sampleRate: number;
|
|
11
11
|
channels: number;
|
|
12
12
|
samplesPerChannel: number;
|
|
13
|
+
private _userdata;
|
|
13
14
|
constructor(data: Int16Array, sampleRate: number, channels: number, samplesPerChannel: number);
|
|
14
15
|
static create(sampleRate: number, channels: number, samplesPerChannel: number): AudioFrame;
|
|
15
16
|
/** @internal */
|
|
16
17
|
static fromOwnedInfo(owned: OwnedAudioFrameBuffer): AudioFrame;
|
|
17
18
|
/** @internal */
|
|
18
19
|
protoInfo(): AudioFrameBufferInfo;
|
|
20
|
+
/** Returns the user data associated with the audio frame. */
|
|
21
|
+
get userdata(): Record<string, unknown>;
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
24
|
* Combines one or more `rtc.AudioFrame` objects into a single `rtc.AudioFrame`.
|
package/dist/audio_frame.d.ts
CHANGED
|
@@ -10,12 +10,15 @@ declare class AudioFrame {
|
|
|
10
10
|
sampleRate: number;
|
|
11
11
|
channels: number;
|
|
12
12
|
samplesPerChannel: number;
|
|
13
|
+
private _userdata;
|
|
13
14
|
constructor(data: Int16Array, sampleRate: number, channels: number, samplesPerChannel: number);
|
|
14
15
|
static create(sampleRate: number, channels: number, samplesPerChannel: number): AudioFrame;
|
|
15
16
|
/** @internal */
|
|
16
17
|
static fromOwnedInfo(owned: OwnedAudioFrameBuffer): AudioFrame;
|
|
17
18
|
/** @internal */
|
|
18
19
|
protoInfo(): AudioFrameBufferInfo;
|
|
20
|
+
/** Returns the user data associated with the audio frame. */
|
|
21
|
+
get userdata(): Record<string, unknown>;
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
24
|
* Combines one or more `rtc.AudioFrame` objects into a single `rtc.AudioFrame`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio_frame.d.ts","sourceRoot":"","sources":["../src/audio_frame.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,qBAAa,UAAU;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"audio_frame.d.ts","sourceRoot":"","sources":["../src/audio_frame.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,qBAAa,UAAU;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAE1B,OAAO,CAAC,SAAS,CAA+B;gBAOpC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM;IAO7F,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,UAAU;IAK1F,gBAAgB;IAChB,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,qBAAqB,GAAG,UAAU;IAa9D,gBAAgB;IAChB,SAAS,IAAI,oBAAoB;IASjC,6DAA6D;IAC7D,IAAI,QAAQ,4BAEX;CACF;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,UAAU,GAAG,UAAU,EAAE,KAAG,UA4BtE,CAAC"}
|
package/dist/audio_frame.js
CHANGED
|
@@ -7,6 +7,7 @@ class AudioFrame {
|
|
|
7
7
|
// it is recommended to use buffer.subarray instead.
|
|
8
8
|
// XXX(nbsp): add this when writing proper docs
|
|
9
9
|
constructor(data, sampleRate, channels, samplesPerChannel) {
|
|
10
|
+
this._userdata = {};
|
|
10
11
|
this.data = data;
|
|
11
12
|
this.sampleRate = sampleRate;
|
|
12
13
|
this.channels = channels;
|
|
@@ -38,6 +39,10 @@ class AudioFrame {
|
|
|
38
39
|
samplesPerChannel: this.samplesPerChannel
|
|
39
40
|
});
|
|
40
41
|
}
|
|
42
|
+
/** Returns the user data associated with the audio frame. */
|
|
43
|
+
get userdata() {
|
|
44
|
+
return this._userdata;
|
|
45
|
+
}
|
|
41
46
|
}
|
|
42
47
|
const combineAudioFrames = (buffer) => {
|
|
43
48
|
if (!Array.isArray(buffer)) {
|
package/dist/audio_frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/audio_frame.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type { OwnedAudioFrameBuffer } from './proto/audio_frame_pb.js';\nimport { AudioFrameBufferInfo } 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 new AudioFrameBufferInfo({\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;\n }\n buffer = buffer as AudioFrame[];\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,WAAW,iBAAiB;AAErC,SAAS,4BAA4B;AAE9B,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/audio_frame.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type { OwnedAudioFrameBuffer } from './proto/audio_frame_pb.js';\nimport { AudioFrameBufferInfo } from './proto/audio_frame_pb.js';\n\nexport class AudioFrame {\n data: Int16Array;\n sampleRate: number;\n channels: number;\n samplesPerChannel: number;\n\n private _userdata: Record<string, unknown> = {};\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 new AudioFrameBufferInfo({\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 /** Returns the user data associated with the audio frame. */\n get userdata() {\n return this._userdata;\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;\n }\n buffer = buffer as AudioFrame[];\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,WAAW,iBAAiB;AAErC,SAAS,4BAA4B;AAE9B,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAatB,YAAY,MAAkB,YAAoB,UAAkB,mBAA2B;AAP/F,SAAQ,YAAqC,CAAC;AAQ5C,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;A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SAAO,IAAI,WAAW,MAAM,YAAY,UAAU,sBAAsB;AAC1E;","names":[]}
|
|
@@ -0,0 +1,281 @@
|
|
|
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_mixer_exports = {};
|
|
20
|
+
__export(audio_mixer_exports, {
|
|
21
|
+
AsyncQueue: () => import_async_queue2.AsyncQueue,
|
|
22
|
+
AudioMixer: () => AudioMixer
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(audio_mixer_exports);
|
|
25
|
+
var import_async_queue = require("./async_queue.cjs");
|
|
26
|
+
var import_audio_frame = require("./audio_frame.cjs");
|
|
27
|
+
var import_async_queue2 = require("./async_queue.cjs");
|
|
28
|
+
class AudioMixer {
|
|
29
|
+
/**
|
|
30
|
+
* Initialize the AudioMixer.
|
|
31
|
+
*
|
|
32
|
+
* @param sampleRate - The audio sample rate in Hz.
|
|
33
|
+
* @param numChannels - The number of audio channels.
|
|
34
|
+
* @param options - Optional configuration for the mixer.
|
|
35
|
+
*/
|
|
36
|
+
constructor(sampleRate, numChannels, options = {}) {
|
|
37
|
+
this.streams = /* @__PURE__ */ new Set();
|
|
38
|
+
this.buffers = /* @__PURE__ */ new Map();
|
|
39
|
+
this.streamIterators = /* @__PURE__ */ new Map();
|
|
40
|
+
this.sampleRate = sampleRate;
|
|
41
|
+
this.numChannels = numChannels;
|
|
42
|
+
this.chunkSize = options.blocksize && options.blocksize > 0 ? options.blocksize : Math.floor(sampleRate / 10);
|
|
43
|
+
this.streamTimeoutMs = options.streamTimeoutMs ?? 100;
|
|
44
|
+
this.queue = new import_async_queue.AsyncQueue(options.capacity ?? 100);
|
|
45
|
+
this.streamSignal = new import_async_queue.AsyncQueue(1);
|
|
46
|
+
this.ending = false;
|
|
47
|
+
this.closed = false;
|
|
48
|
+
this.mixerTask = this.mixer();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Add an audio stream to the mixer.
|
|
52
|
+
*
|
|
53
|
+
* The stream is added to the internal set of streams and an empty buffer is initialized for it,
|
|
54
|
+
* if not already present.
|
|
55
|
+
*
|
|
56
|
+
* @param stream - An async iterable that produces AudioFrame objects.
|
|
57
|
+
* @throws Error if the mixer has been closed.
|
|
58
|
+
*/
|
|
59
|
+
addStream(stream) {
|
|
60
|
+
if (this.ending) {
|
|
61
|
+
throw new Error("Cannot add stream after mixer has been closed");
|
|
62
|
+
}
|
|
63
|
+
this.streams.add(stream);
|
|
64
|
+
if (!this.buffers.has(stream)) {
|
|
65
|
+
this.buffers.set(stream, new Int16Array(0));
|
|
66
|
+
}
|
|
67
|
+
this.streamSignal.put(void 0).catch(() => {
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Remove an audio stream from the mixer.
|
|
72
|
+
*
|
|
73
|
+
* This method removes the specified stream and its associated buffer from the mixer.
|
|
74
|
+
*
|
|
75
|
+
* @param stream - The audio stream to remove.
|
|
76
|
+
*/
|
|
77
|
+
removeStream(stream) {
|
|
78
|
+
this.streams.delete(stream);
|
|
79
|
+
this.buffers.delete(stream);
|
|
80
|
+
this.streamIterators.delete(stream);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Returns an async iterator for the mixed audio frames.
|
|
84
|
+
*/
|
|
85
|
+
[Symbol.asyncIterator]() {
|
|
86
|
+
return {
|
|
87
|
+
next: async () => {
|
|
88
|
+
const frame = await this.getNextFrame();
|
|
89
|
+
if (frame === null) {
|
|
90
|
+
return { done: true, value: void 0 };
|
|
91
|
+
}
|
|
92
|
+
return { done: false, value: frame };
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Immediately stop mixing and close the mixer.
|
|
98
|
+
*
|
|
99
|
+
* This stops the mixing task, and any unconsumed output in the queue may be dropped.
|
|
100
|
+
*/
|
|
101
|
+
async aclose() {
|
|
102
|
+
if (this.closed) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.closed = true;
|
|
106
|
+
this.ending = true;
|
|
107
|
+
this.streamSignal.close();
|
|
108
|
+
this.queue.close();
|
|
109
|
+
await this.mixerTask;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Signal that no more streams will be added.
|
|
113
|
+
*
|
|
114
|
+
* This method marks the mixer as closed so that it flushes any remaining buffered output before ending.
|
|
115
|
+
* Note that existing streams will still be processed until exhausted.
|
|
116
|
+
*/
|
|
117
|
+
endInput() {
|
|
118
|
+
this.ending = true;
|
|
119
|
+
}
|
|
120
|
+
async getNextFrame() {
|
|
121
|
+
while (true) {
|
|
122
|
+
const frame = this.queue.get();
|
|
123
|
+
if (frame !== void 0) {
|
|
124
|
+
return frame;
|
|
125
|
+
}
|
|
126
|
+
if (this.queue.closed || this.ending && this.streams.size === 0) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
await this.queue.waitForItem();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async mixer() {
|
|
133
|
+
while (true) {
|
|
134
|
+
if (this.ending && this.streams.size === 0) {
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
if (this.streams.size === 0) {
|
|
138
|
+
await this.streamSignal.waitForItem();
|
|
139
|
+
this.streamSignal.get();
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const streamArray = Array.from(this.streams);
|
|
143
|
+
const promises = streamArray.map((stream) => this.getContribution(stream));
|
|
144
|
+
const results = await Promise.all(
|
|
145
|
+
promises.map(
|
|
146
|
+
(p) => p.then((value) => ({ status: "fulfilled", value })).catch((reason) => ({ status: "rejected", reason }))
|
|
147
|
+
)
|
|
148
|
+
);
|
|
149
|
+
const contributions = [];
|
|
150
|
+
let anyData = false;
|
|
151
|
+
const removals = [];
|
|
152
|
+
for (const result of results) {
|
|
153
|
+
if (result.status !== "fulfilled") {
|
|
154
|
+
console.warn("AudioMixer: Stream contribution failed:", result.reason);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const contrib = result.value;
|
|
158
|
+
contributions.push(contrib.data);
|
|
159
|
+
this.buffers.set(contrib.stream, contrib.buffer);
|
|
160
|
+
if (contrib.hadData) {
|
|
161
|
+
anyData = true;
|
|
162
|
+
}
|
|
163
|
+
if (contrib.exhausted && contrib.buffer.length === 0) {
|
|
164
|
+
removals.push(contrib.stream);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
for (const stream of removals) {
|
|
168
|
+
this.removeStream(stream);
|
|
169
|
+
}
|
|
170
|
+
if (!anyData) {
|
|
171
|
+
await this.sleep(1);
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const mixed = this.mixAudio(contributions);
|
|
175
|
+
const frame = new import_audio_frame.AudioFrame(mixed, this.sampleRate, this.numChannels, this.chunkSize);
|
|
176
|
+
if (this.closed) {
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
await this.queue.put(frame);
|
|
181
|
+
} catch {
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
this.queue.close();
|
|
186
|
+
}
|
|
187
|
+
async getContribution(stream) {
|
|
188
|
+
let buf = this.buffers.get(stream) ?? new Int16Array(0);
|
|
189
|
+
const initialBufferLength = buf.length;
|
|
190
|
+
let exhausted = false;
|
|
191
|
+
let receivedDataInThisCall = false;
|
|
192
|
+
let iterator = this.streamIterators.get(stream);
|
|
193
|
+
if (!iterator) {
|
|
194
|
+
iterator = stream[Symbol.asyncIterator]();
|
|
195
|
+
this.streamIterators.set(stream, iterator);
|
|
196
|
+
}
|
|
197
|
+
while (buf.length < this.chunkSize * this.numChannels && !exhausted && !this.closed) {
|
|
198
|
+
try {
|
|
199
|
+
const result = await Promise.race([iterator.next(), this.timeout(this.streamTimeoutMs)]);
|
|
200
|
+
if (result === "timeout") {
|
|
201
|
+
console.warn(`AudioMixer: stream timeout after ${this.streamTimeoutMs}ms`);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
if (result.done) {
|
|
205
|
+
exhausted = true;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
const frame = result.value;
|
|
209
|
+
const newData = frame.data;
|
|
210
|
+
receivedDataInThisCall = true;
|
|
211
|
+
if (buf.length === 0) {
|
|
212
|
+
buf = newData;
|
|
213
|
+
} else {
|
|
214
|
+
const combined = new Int16Array(buf.length + newData.length);
|
|
215
|
+
combined.set(buf);
|
|
216
|
+
combined.set(newData, buf.length);
|
|
217
|
+
buf = combined;
|
|
218
|
+
}
|
|
219
|
+
} catch (error) {
|
|
220
|
+
console.error(`AudioMixer: Error reading from stream:`, error);
|
|
221
|
+
exhausted = true;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
let contrib;
|
|
226
|
+
const samplesNeeded = this.chunkSize * this.numChannels;
|
|
227
|
+
if (buf.length >= samplesNeeded) {
|
|
228
|
+
contrib = buf.subarray(0, samplesNeeded);
|
|
229
|
+
buf = buf.subarray(samplesNeeded);
|
|
230
|
+
} else {
|
|
231
|
+
const padded = new Int16Array(samplesNeeded);
|
|
232
|
+
padded.set(buf);
|
|
233
|
+
contrib = padded;
|
|
234
|
+
buf = new Int16Array(0);
|
|
235
|
+
}
|
|
236
|
+
const hadData = initialBufferLength > 0 || receivedDataInThisCall || buf.length > 0;
|
|
237
|
+
return {
|
|
238
|
+
stream,
|
|
239
|
+
data: contrib,
|
|
240
|
+
buffer: buf,
|
|
241
|
+
hadData,
|
|
242
|
+
exhausted
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
mixAudio(contributions) {
|
|
246
|
+
if (contributions.length === 0) {
|
|
247
|
+
return new Int16Array(this.chunkSize * this.numChannels);
|
|
248
|
+
}
|
|
249
|
+
const length = this.chunkSize * this.numChannels;
|
|
250
|
+
const mixed = new Int16Array(length);
|
|
251
|
+
for (const contrib of contributions) {
|
|
252
|
+
for (let i = 0; i < length; i++) {
|
|
253
|
+
const val = contrib[i];
|
|
254
|
+
if (val !== void 0) {
|
|
255
|
+
mixed[i] = (mixed[i] ?? 0) + val;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
for (let i = 0; i < length; i++) {
|
|
260
|
+
const val = mixed[i] ?? 0;
|
|
261
|
+
if (val > 32767) {
|
|
262
|
+
mixed[i] = 32767;
|
|
263
|
+
} else if (val < -32768) {
|
|
264
|
+
mixed[i] = -32768;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return mixed;
|
|
268
|
+
}
|
|
269
|
+
sleep(ms) {
|
|
270
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
271
|
+
}
|
|
272
|
+
timeout(ms) {
|
|
273
|
+
return new Promise((resolve) => setTimeout(() => resolve("timeout"), ms));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
277
|
+
0 && (module.exports = {
|
|
278
|
+
AsyncQueue,
|
|
279
|
+
AudioMixer
|
|
280
|
+
});
|
|
281
|
+
//# sourceMappingURL=audio_mixer.cjs.map
|