@livekit/rtc-node 0.9.2 → 0.10.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.d.ts +10 -0
- package/dist/audio_frame.d.ts.map +1 -1
- package/dist/audio_frame.js +32 -0
- package/dist/audio_frame.js.map +1 -1
- package/dist/audio_resampler.d.ts +51 -0
- package/dist/audio_resampler.d.ts.map +1 -0
- package/dist/audio_resampler.js +138 -0
- package/dist/audio_resampler.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/proto/audio_frame_pb.d.ts +281 -0
- package/dist/proto/audio_frame_pb.d.ts.map +1 -1
- package/dist/proto/audio_frame_pb.js +398 -0
- package/dist/proto/audio_frame_pb.js.map +1 -1
- package/dist/proto/ffi_pb.d.ts +37 -1
- package/dist/proto/ffi_pb.d.ts.map +1 -1
- package/dist/proto/ffi_pb.js +7 -1
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +11 -4
- package/dist/utils.js.map +1 -1
- package/package.json +6 -6
- package/src/audio_frame.ts +39 -0
- package/src/audio_resampler.ts +166 -0
- package/src/index.ts +1 -0
- package/src/proto/audio_frame_pb.ts +502 -0
- package/src/proto/ffi_pb.ts +43 -1
- package/src/utils.test.ts +47 -0
- package/src/utils.ts +12 -4
package/dist/audio_frame.d.ts
CHANGED
|
@@ -12,4 +12,14 @@ export declare class AudioFrame {
|
|
|
12
12
|
/** @internal */
|
|
13
13
|
protoInfo(): AudioFrameBufferInfo;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Combines one or more `rtc.AudioFrame` objects into a single `rtc.AudioFrame`.
|
|
17
|
+
*
|
|
18
|
+
* This function concatenates the audio data from multiple frames, ensuring that all frames have
|
|
19
|
+
* the same sample rate and number of channels. It efficiently merges the data by preallocating the
|
|
20
|
+
* necessary memory and copying the frame data without unnecessary reallocations.
|
|
21
|
+
*
|
|
22
|
+
* @param buffer - a single AudioFrame or list thereof
|
|
23
|
+
*/
|
|
24
|
+
export declare const combineAudioFrames: (buffer: AudioFrame | AudioFrame[]) => AudioFrame;
|
|
15
25
|
//# sourceMappingURL=audio_frame.d.ts.map
|
|
@@ -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;gBAOd,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;CAQlC"}
|
|
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;gBAOd,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;CAQlC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,WAAY,UAAU,GAAG,UAAU,EAAE,KAAG,UA4BtE,CAAC"}
|
package/dist/audio_frame.js
CHANGED
|
@@ -37,4 +37,36 @@ export class AudioFrame {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Combines one or more `rtc.AudioFrame` objects into a single `rtc.AudioFrame`.
|
|
42
|
+
*
|
|
43
|
+
* This function concatenates the audio data from multiple frames, ensuring that all frames have
|
|
44
|
+
* the same sample rate and number of channels. It efficiently merges the data by preallocating the
|
|
45
|
+
* necessary memory and copying the frame data without unnecessary reallocations.
|
|
46
|
+
*
|
|
47
|
+
* @param buffer - a single AudioFrame or list thereof
|
|
48
|
+
*/
|
|
49
|
+
export const combineAudioFrames = (buffer) => {
|
|
50
|
+
if (!buffer['length']) {
|
|
51
|
+
return buffer;
|
|
52
|
+
}
|
|
53
|
+
buffer = buffer;
|
|
54
|
+
if (buffer.length === 0) {
|
|
55
|
+
throw new Error('buffer is empty');
|
|
56
|
+
}
|
|
57
|
+
const sampleRate = buffer[0].sampleRate;
|
|
58
|
+
const channels = buffer[0].channels;
|
|
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;
|
|
68
|
+
}
|
|
69
|
+
const data = new Int16Array(buffer.map((x) => [...x.data]).flat());
|
|
70
|
+
return new AudioFrame(data, sampleRate, channels, totalSamplesPerChannel);
|
|
71
|
+
};
|
|
40
72
|
//# sourceMappingURL=audio_frame.js.map
|
package/dist/audio_frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio_frame.js","sourceRoot":"","sources":["../src/audio_frame.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,UAAU;IAMrB,gFAAgF;IAChF,6FAA6F;IAC7F,gCAAgC;IAChC,oDAAoD;IACpD,+CAA+C;IAC/C,YAAY,IAAgB,EAAE,UAAkB,EAAE,QAAgB,EAAE,iBAAyB;QAC3F,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,UAAkB,EAAE,QAAgB,EAAE,iBAAyB;QAC3E,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,QAAQ,GAAG,iBAAiB,CAAC,CAAC;QAC1D,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IACvE,CAAC;IAED,gB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AU,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC;AAC5E,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AudioFrame } from './audio_frame';
|
|
2
|
+
/**
|
|
3
|
+
* Resampler quality. Higher quality settings result in better audio quality but require more
|
|
4
|
+
* processing power.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum AudioResamplerQuality {
|
|
7
|
+
QUICK = 0,
|
|
8
|
+
LOW = 1,
|
|
9
|
+
MEDIUM = 2,
|
|
10
|
+
HIGH = 3,
|
|
11
|
+
VERY_HIGH = 4
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* AudioResampler provides functionality to resample audio data from an input sample rate to
|
|
15
|
+
* an output sample rate using the Sox resampling library. It supports multiple channels and
|
|
16
|
+
* configurable resampling quality.
|
|
17
|
+
*/
|
|
18
|
+
export declare class AudioResampler {
|
|
19
|
+
#private;
|
|
20
|
+
/**
|
|
21
|
+
* Initializes a new AudioResampler.
|
|
22
|
+
*
|
|
23
|
+
* @param inputRate - The sample rate of the input audio data (in Hz).
|
|
24
|
+
* @param outputRate - The desired sample rate of the output audio data (in Hz).
|
|
25
|
+
* @param channels - The number of audio channels (e.g., 1 for mono, 2 for stereo). Defaults to 1.
|
|
26
|
+
* @param quality - The quality setting for the resampler. Defaults to
|
|
27
|
+
* `AudioResamplerQuality.MEDIUM`.
|
|
28
|
+
*/
|
|
29
|
+
constructor(inputRate: number, outputRate: number, channels?: number, quality?: AudioResamplerQuality);
|
|
30
|
+
/**
|
|
31
|
+
* Push audio data into the resampler and retrieve any available resampled data.
|
|
32
|
+
*
|
|
33
|
+
* This method accepts audio data, resamples it according to the configured input and output rates,
|
|
34
|
+
* and returns any resampled data that is available after processing the input.
|
|
35
|
+
*
|
|
36
|
+
* @param data - The audio frame to resample
|
|
37
|
+
*
|
|
38
|
+
* @returns A list of {@link AudioFrame} objects containing the resampled audio data. The list may
|
|
39
|
+
* be empty if no output data is available yet.
|
|
40
|
+
*/
|
|
41
|
+
push(data: AudioFrame): AudioFrame[];
|
|
42
|
+
/**
|
|
43
|
+
* Flush any remaining audio data through the resampler and retrieve the resampled data.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* This method should be called when no more input data will be provided to ensure that all
|
|
47
|
+
* internal buffers are processed and all resampled data is output.
|
|
48
|
+
*/
|
|
49
|
+
flush(): AudioFrame[];
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=audio_resampler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio_resampler.d.ts","sourceRoot":"","sources":["../src/audio_resampler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAe3C;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B,KAAK,IAAsC;IAC3C,GAAG,IAAoC;IACvC,MAAM,IAAuC;IAC7C,IAAI,IAAqC;IACzC,SAAS,IAAyC;CACnD;AAED;;;;GAIG;AACH,qBAAa,cAAc;;IAMzB;;;;;;;;OAQG;gBAED,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,SAAI,EACZ,OAAO,wBAA+B;IA8BxC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,EAAE;IAiCpC;;;;;;OAMG;IACH,KAAK,IAAI,UAAU,EAAE;CA8BtB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _AudioResampler_inputRate, _AudioResampler_outputRate, _AudioResampler_channels, _AudioResampler_ffiHandle;
|
|
13
|
+
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
import { AudioFrame } from './audio_frame';
|
|
17
|
+
import { FfiClient, FfiHandle } from './ffi_client';
|
|
18
|
+
import { FlushSoxResamplerRequest, NewSoxResamplerRequest, PushSoxResamplerRequest, SoxResamplerDataType, } from './proto/audio_frame_pb';
|
|
19
|
+
/**
|
|
20
|
+
* Resampler quality. Higher quality settings result in better audio quality but require more
|
|
21
|
+
* processing power.
|
|
22
|
+
*/
|
|
23
|
+
export var AudioResamplerQuality;
|
|
24
|
+
(function (AudioResamplerQuality) {
|
|
25
|
+
AudioResamplerQuality[AudioResamplerQuality["QUICK"] = 0] = "QUICK";
|
|
26
|
+
AudioResamplerQuality[AudioResamplerQuality["LOW"] = 1] = "LOW";
|
|
27
|
+
AudioResamplerQuality[AudioResamplerQuality["MEDIUM"] = 2] = "MEDIUM";
|
|
28
|
+
AudioResamplerQuality[AudioResamplerQuality["HIGH"] = 3] = "HIGH";
|
|
29
|
+
AudioResamplerQuality[AudioResamplerQuality["VERY_HIGH"] = 4] = "VERY_HIGH";
|
|
30
|
+
})(AudioResamplerQuality || (AudioResamplerQuality = {}));
|
|
31
|
+
/**
|
|
32
|
+
* AudioResampler provides functionality to resample audio data from an input sample rate to
|
|
33
|
+
* an output sample rate using the Sox resampling library. It supports multiple channels and
|
|
34
|
+
* configurable resampling quality.
|
|
35
|
+
*/
|
|
36
|
+
export class AudioResampler {
|
|
37
|
+
/**
|
|
38
|
+
* Initializes a new AudioResampler.
|
|
39
|
+
*
|
|
40
|
+
* @param inputRate - The sample rate of the input audio data (in Hz).
|
|
41
|
+
* @param outputRate - The desired sample rate of the output audio data (in Hz).
|
|
42
|
+
* @param channels - The number of audio channels (e.g., 1 for mono, 2 for stereo). Defaults to 1.
|
|
43
|
+
* @param quality - The quality setting for the resampler. Defaults to
|
|
44
|
+
* `AudioResamplerQuality.MEDIUM`.
|
|
45
|
+
*/
|
|
46
|
+
constructor(inputRate, outputRate, channels = 1, quality = AudioResamplerQuality.MEDIUM) {
|
|
47
|
+
_AudioResampler_inputRate.set(this, void 0);
|
|
48
|
+
_AudioResampler_outputRate.set(this, void 0);
|
|
49
|
+
_AudioResampler_channels.set(this, void 0);
|
|
50
|
+
_AudioResampler_ffiHandle.set(this, void 0);
|
|
51
|
+
__classPrivateFieldSet(this, _AudioResampler_inputRate, inputRate, "f");
|
|
52
|
+
__classPrivateFieldSet(this, _AudioResampler_outputRate, outputRate, "f");
|
|
53
|
+
__classPrivateFieldSet(this, _AudioResampler_channels, channels, "f");
|
|
54
|
+
const req = new NewSoxResamplerRequest({
|
|
55
|
+
inputRate,
|
|
56
|
+
outputRate,
|
|
57
|
+
numChannels: channels,
|
|
58
|
+
qualityRecipe: quality,
|
|
59
|
+
inputDataType: SoxResamplerDataType.SOXR_DATATYPE_INT16I,
|
|
60
|
+
outputDataType: SoxResamplerDataType.SOXR_DATATYPE_INT16I,
|
|
61
|
+
flags: 0,
|
|
62
|
+
});
|
|
63
|
+
const res = FfiClient.instance.request({
|
|
64
|
+
message: {
|
|
65
|
+
case: 'newSoxResampler',
|
|
66
|
+
value: req,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
if (res.error) {
|
|
70
|
+
throw new Error(res.error);
|
|
71
|
+
}
|
|
72
|
+
__classPrivateFieldSet(this, _AudioResampler_ffiHandle, new FfiHandle(res.resampler.handle.id), "f");
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Push audio data into the resampler and retrieve any available resampled data.
|
|
76
|
+
*
|
|
77
|
+
* This method accepts audio data, resamples it according to the configured input and output rates,
|
|
78
|
+
* and returns any resampled data that is available after processing the input.
|
|
79
|
+
*
|
|
80
|
+
* @param data - The audio frame to resample
|
|
81
|
+
*
|
|
82
|
+
* @returns A list of {@link AudioFrame} objects containing the resampled audio data. The list may
|
|
83
|
+
* be empty if no output data is available yet.
|
|
84
|
+
*/
|
|
85
|
+
push(data) {
|
|
86
|
+
const req = new PushSoxResamplerRequest({
|
|
87
|
+
resamplerHandle: __classPrivateFieldGet(this, _AudioResampler_ffiHandle, "f").handle,
|
|
88
|
+
dataPtr: data.protoInfo().dataPtr,
|
|
89
|
+
size: data.data.length,
|
|
90
|
+
});
|
|
91
|
+
const res = FfiClient.instance.request({
|
|
92
|
+
message: {
|
|
93
|
+
case: 'pushSoxResampler',
|
|
94
|
+
value: req,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
if (res.error) {
|
|
98
|
+
throw new Error(res.error);
|
|
99
|
+
}
|
|
100
|
+
if (res.outputPtr) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
const outputData = FfiClient.instance.copyBuffer(res.outputPtr, res.size);
|
|
104
|
+
return [
|
|
105
|
+
new AudioFrame(new Int16Array(outputData.subarray()), __classPrivateFieldGet(this, _AudioResampler_outputRate, "f"), __classPrivateFieldGet(this, _AudioResampler_channels, "f"), Math.trunc(outputData.length / __classPrivateFieldGet(this, _AudioResampler_channels, "f") / 2)),
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Flush any remaining audio data through the resampler and retrieve the resampled data.
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* This method should be called when no more input data will be provided to ensure that all
|
|
113
|
+
* internal buffers are processed and all resampled data is output.
|
|
114
|
+
*/
|
|
115
|
+
flush() {
|
|
116
|
+
const req = new FlushSoxResamplerRequest({
|
|
117
|
+
resamplerHandle: __classPrivateFieldGet(this, _AudioResampler_ffiHandle, "f").handle,
|
|
118
|
+
});
|
|
119
|
+
const res = FfiClient.instance.request({
|
|
120
|
+
message: {
|
|
121
|
+
case: 'flushSoxResampler',
|
|
122
|
+
value: req,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
if (res.error) {
|
|
126
|
+
throw new Error(res.error);
|
|
127
|
+
}
|
|
128
|
+
if (res.outputPtr) {
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
const outputData = FfiClient.instance.copyBuffer(res.outputPtr, res.size);
|
|
132
|
+
return [
|
|
133
|
+
new AudioFrame(new Int16Array(outputData.subarray()), __classPrivateFieldGet(this, _AudioResampler_outputRate, "f"), __classPrivateFieldGet(this, _AudioResampler_channels, "f"), Math.trunc(outputData.length / __classPrivateFieldGet(this, _AudioResampler_channels, "f") / 2)),
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
_AudioResampler_inputRate = new WeakMap(), _AudioResampler_outputRate = new WeakMap(), _AudioResampler_channels = new WeakMap(), _AudioResampler_ffiHandle = new WeakMap();
|
|
138
|
+
//# sourceMappingURL=audio_resampler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio_resampler.js","sourceRoot":"","sources":["../src/audio_resampler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA6C;AAC7C,EAAE;AACF,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMpD,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EAEvB,oBAAoB,GACrB,MAAM,wBA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;SACF,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QAED,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1E,OAAO;YACL,IAAI,UAAU,CACZ,IAAI,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EACrC,uBAAA,IAAI,kCAAY,EAChB,uBAAA,IAAI,gCAAU,EACd,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,uBAAA,IAAI,gCAAU,GAAG,CAAC,CAAC,CACnD;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { Track, LocalTrack, RemoteTrack, VideoTrack, LocalAudioTrack, LocalVideo
|
|
|
4
4
|
export { VideoFrame } from './video_frame.js';
|
|
5
5
|
export { AudioFrame } from './audio_frame.js';
|
|
6
6
|
export { AudioStream } from './audio_stream.js';
|
|
7
|
+
export { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';
|
|
7
8
|
export { VideoStream, VideoFrameEvent } from './video_stream.js';
|
|
8
9
|
export { AudioSource } from './audio_source.js';
|
|
9
10
|
export { VideoSource } from './video_source.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAA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OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { Track, LocalAudioTrack, LocalVideoTrack, RemoteAudioTrack, RemoteVideoT
|
|
|
7
7
|
export { VideoFrame } from './video_frame.js';
|
|
8
8
|
export { AudioFrame } from './audio_frame.js';
|
|
9
9
|
export { AudioStream } from './audio_stream.js';
|
|
10
|
+
export { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';
|
|
10
11
|
export { VideoStream } from './video_stream.js';
|
|
11
12
|
export { AudioSource } from './audio_source.js';
|
|
12
13
|
export { VideoSource } from './video_source.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,sCAAsC;AAEtC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAiC,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,KAAK,EAIL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB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AAmB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAmC,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -2,6 +2,87 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM
|
|
|
2
2
|
import { Message, proto3 } from "@bufbuild/protobuf";
|
|
3
3
|
import { TrackSource } from "./track_pb.js";
|
|
4
4
|
import { FfiOwnedHandle } from "./handle_pb.js";
|
|
5
|
+
/**
|
|
6
|
+
* @generated from enum livekit.proto.SoxResamplerDataType
|
|
7
|
+
*/
|
|
8
|
+
export declare enum SoxResamplerDataType {
|
|
9
|
+
/**
|
|
10
|
+
* TODO(theomonnom): support other datatypes (shouldn't really be needed)
|
|
11
|
+
*
|
|
12
|
+
* @generated from enum value: SOXR_DATATYPE_INT16I = 0;
|
|
13
|
+
*/
|
|
14
|
+
SOXR_DATATYPE_INT16I = 0,
|
|
15
|
+
/**
|
|
16
|
+
* @generated from enum value: SOXR_DATATYPE_INT16S = 1;
|
|
17
|
+
*/
|
|
18
|
+
SOXR_DATATYPE_INT16S = 1
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @generated from enum livekit.proto.SoxQualityRecipe
|
|
22
|
+
*/
|
|
23
|
+
export declare enum SoxQualityRecipe {
|
|
24
|
+
/**
|
|
25
|
+
* @generated from enum value: SOXR_QUALITY_QUICK = 0;
|
|
26
|
+
*/
|
|
27
|
+
SOXR_QUALITY_QUICK = 0,
|
|
28
|
+
/**
|
|
29
|
+
* @generated from enum value: SOXR_QUALITY_LOW = 1;
|
|
30
|
+
*/
|
|
31
|
+
SOXR_QUALITY_LOW = 1,
|
|
32
|
+
/**
|
|
33
|
+
* @generated from enum value: SOXR_QUALITY_MEDIUM = 2;
|
|
34
|
+
*/
|
|
35
|
+
SOXR_QUALITY_MEDIUM = 2,
|
|
36
|
+
/**
|
|
37
|
+
* @generated from enum value: SOXR_QUALITY_HIGH = 3;
|
|
38
|
+
*/
|
|
39
|
+
SOXR_QUALITY_HIGH = 3,
|
|
40
|
+
/**
|
|
41
|
+
* @generated from enum value: SOXR_QUALITY_VERYHIGH = 4;
|
|
42
|
+
*/
|
|
43
|
+
SOXR_QUALITY_VERYHIGH = 4
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @generated from enum livekit.proto.SoxFlagBits
|
|
47
|
+
*/
|
|
48
|
+
export declare enum SoxFlagBits {
|
|
49
|
+
/**
|
|
50
|
+
* 1 << 0
|
|
51
|
+
*
|
|
52
|
+
* @generated from enum value: SOXR_ROLLOFF_SMALL = 0;
|
|
53
|
+
*/
|
|
54
|
+
SOXR_ROLLOFF_SMALL = 0,
|
|
55
|
+
/**
|
|
56
|
+
* 1 << 1
|
|
57
|
+
*
|
|
58
|
+
* @generated from enum value: SOXR_ROLLOFF_MEDIUM = 1;
|
|
59
|
+
*/
|
|
60
|
+
SOXR_ROLLOFF_MEDIUM = 1,
|
|
61
|
+
/**
|
|
62
|
+
* 1 << 2
|
|
63
|
+
*
|
|
64
|
+
* @generated from enum value: SOXR_ROLLOFF_NONE = 2;
|
|
65
|
+
*/
|
|
66
|
+
SOXR_ROLLOFF_NONE = 2,
|
|
67
|
+
/**
|
|
68
|
+
* 1 << 3
|
|
69
|
+
*
|
|
70
|
+
* @generated from enum value: SOXR_HIGH_PREC_CLOCK = 3;
|
|
71
|
+
*/
|
|
72
|
+
SOXR_HIGH_PREC_CLOCK = 3,
|
|
73
|
+
/**
|
|
74
|
+
* 1 << 4
|
|
75
|
+
*
|
|
76
|
+
* @generated from enum value: SOXR_DOUBLE_PRECISION = 4;
|
|
77
|
+
*/
|
|
78
|
+
SOXR_DOUBLE_PRECISION = 4,
|
|
79
|
+
/**
|
|
80
|
+
* 1 << 5
|
|
81
|
+
*
|
|
82
|
+
* @generated from enum value: SOXR_VR = 5;
|
|
83
|
+
*/
|
|
84
|
+
SOXR_VR = 5
|
|
85
|
+
}
|
|
5
86
|
/**
|
|
6
87
|
* @generated from enum livekit.proto.AudioStreamType
|
|
7
88
|
*/
|
|
@@ -347,6 +428,172 @@ export declare class RemixAndResampleResponse extends Message<RemixAndResampleRe
|
|
|
347
428
|
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RemixAndResampleResponse;
|
|
348
429
|
static equals(a: RemixAndResampleResponse | PlainMessage<RemixAndResampleResponse> | undefined, b: RemixAndResampleResponse | PlainMessage<RemixAndResampleResponse> | undefined): boolean;
|
|
349
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* @generated from message livekit.proto.NewSoxResamplerRequest
|
|
433
|
+
*/
|
|
434
|
+
export declare class NewSoxResamplerRequest extends Message<NewSoxResamplerRequest> {
|
|
435
|
+
/**
|
|
436
|
+
* @generated from field: double input_rate = 1;
|
|
437
|
+
*/
|
|
438
|
+
inputRate: number;
|
|
439
|
+
/**
|
|
440
|
+
* @generated from field: double output_rate = 2;
|
|
441
|
+
*/
|
|
442
|
+
outputRate: number;
|
|
443
|
+
/**
|
|
444
|
+
* @generated from field: uint32 num_channels = 3;
|
|
445
|
+
*/
|
|
446
|
+
numChannels: number;
|
|
447
|
+
/**
|
|
448
|
+
* @generated from field: livekit.proto.SoxResamplerDataType input_data_type = 4;
|
|
449
|
+
*/
|
|
450
|
+
inputDataType: SoxResamplerDataType;
|
|
451
|
+
/**
|
|
452
|
+
* @generated from field: livekit.proto.SoxResamplerDataType output_data_type = 5;
|
|
453
|
+
*/
|
|
454
|
+
outputDataType: SoxResamplerDataType;
|
|
455
|
+
/**
|
|
456
|
+
* @generated from field: livekit.proto.SoxQualityRecipe quality_recipe = 6;
|
|
457
|
+
*/
|
|
458
|
+
qualityRecipe: SoxQualityRecipe;
|
|
459
|
+
/**
|
|
460
|
+
* @generated from field: uint32 flags = 7;
|
|
461
|
+
*/
|
|
462
|
+
flags: number;
|
|
463
|
+
constructor(data?: PartialMessage<NewSoxResamplerRequest>);
|
|
464
|
+
static readonly runtime: typeof proto3;
|
|
465
|
+
static readonly typeName = "livekit.proto.NewSoxResamplerRequest";
|
|
466
|
+
static readonly fields: FieldList;
|
|
467
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): NewSoxResamplerRequest;
|
|
468
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): NewSoxResamplerRequest;
|
|
469
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): NewSoxResamplerRequest;
|
|
470
|
+
static equals(a: NewSoxResamplerRequest | PlainMessage<NewSoxResamplerRequest> | undefined, b: NewSoxResamplerRequest | PlainMessage<NewSoxResamplerRequest> | undefined): boolean;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* @generated from message livekit.proto.NewSoxResamplerResponse
|
|
474
|
+
*/
|
|
475
|
+
export declare class NewSoxResamplerResponse extends Message<NewSoxResamplerResponse> {
|
|
476
|
+
/**
|
|
477
|
+
* @generated from field: livekit.proto.OwnedSoxResampler resampler = 1;
|
|
478
|
+
*/
|
|
479
|
+
resampler?: OwnedSoxResampler;
|
|
480
|
+
/**
|
|
481
|
+
* @generated from field: optional string error = 2;
|
|
482
|
+
*/
|
|
483
|
+
error?: string;
|
|
484
|
+
constructor(data?: PartialMessage<NewSoxResamplerResponse>);
|
|
485
|
+
static readonly runtime: typeof proto3;
|
|
486
|
+
static readonly typeName = "livekit.proto.NewSoxResamplerResponse";
|
|
487
|
+
static readonly fields: FieldList;
|
|
488
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): NewSoxResamplerResponse;
|
|
489
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): NewSoxResamplerResponse;
|
|
490
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): NewSoxResamplerResponse;
|
|
491
|
+
static equals(a: NewSoxResamplerResponse | PlainMessage<NewSoxResamplerResponse> | undefined, b: NewSoxResamplerResponse | PlainMessage<NewSoxResamplerResponse> | undefined): boolean;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* @generated from message livekit.proto.PushSoxResamplerRequest
|
|
495
|
+
*/
|
|
496
|
+
export declare class PushSoxResamplerRequest extends Message<PushSoxResamplerRequest> {
|
|
497
|
+
/**
|
|
498
|
+
* @generated from field: uint64 resampler_handle = 1;
|
|
499
|
+
*/
|
|
500
|
+
resamplerHandle: bigint;
|
|
501
|
+
/**
|
|
502
|
+
* *const i16
|
|
503
|
+
*
|
|
504
|
+
* @generated from field: uint64 data_ptr = 2;
|
|
505
|
+
*/
|
|
506
|
+
dataPtr: bigint;
|
|
507
|
+
/**
|
|
508
|
+
* in bytes
|
|
509
|
+
*
|
|
510
|
+
* @generated from field: uint32 size = 3;
|
|
511
|
+
*/
|
|
512
|
+
size: number;
|
|
513
|
+
constructor(data?: PartialMessage<PushSoxResamplerRequest>);
|
|
514
|
+
static readonly runtime: typeof proto3;
|
|
515
|
+
static readonly typeName = "livekit.proto.PushSoxResamplerRequest";
|
|
516
|
+
static readonly fields: FieldList;
|
|
517
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PushSoxResamplerRequest;
|
|
518
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PushSoxResamplerRequest;
|
|
519
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PushSoxResamplerRequest;
|
|
520
|
+
static equals(a: PushSoxResamplerRequest | PlainMessage<PushSoxResamplerRequest> | undefined, b: PushSoxResamplerRequest | PlainMessage<PushSoxResamplerRequest> | undefined): boolean;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* @generated from message livekit.proto.PushSoxResamplerResponse
|
|
524
|
+
*/
|
|
525
|
+
export declare class PushSoxResamplerResponse extends Message<PushSoxResamplerResponse> {
|
|
526
|
+
/**
|
|
527
|
+
* *const i16 (could be null)
|
|
528
|
+
*
|
|
529
|
+
* @generated from field: uint64 output_ptr = 1;
|
|
530
|
+
*/
|
|
531
|
+
outputPtr: bigint;
|
|
532
|
+
/**
|
|
533
|
+
* in bytes
|
|
534
|
+
*
|
|
535
|
+
* @generated from field: uint32 size = 2;
|
|
536
|
+
*/
|
|
537
|
+
size: number;
|
|
538
|
+
/**
|
|
539
|
+
* @generated from field: optional string error = 3;
|
|
540
|
+
*/
|
|
541
|
+
error?: string;
|
|
542
|
+
constructor(data?: PartialMessage<PushSoxResamplerResponse>);
|
|
543
|
+
static readonly runtime: typeof proto3;
|
|
544
|
+
static readonly typeName = "livekit.proto.PushSoxResamplerResponse";
|
|
545
|
+
static readonly fields: FieldList;
|
|
546
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PushSoxResamplerResponse;
|
|
547
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PushSoxResamplerResponse;
|
|
548
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PushSoxResamplerResponse;
|
|
549
|
+
static equals(a: PushSoxResamplerResponse | PlainMessage<PushSoxResamplerResponse> | undefined, b: PushSoxResamplerResponse | PlainMessage<PushSoxResamplerResponse> | undefined): boolean;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* @generated from message livekit.proto.FlushSoxResamplerRequest
|
|
553
|
+
*/
|
|
554
|
+
export declare class FlushSoxResamplerRequest extends Message<FlushSoxResamplerRequest> {
|
|
555
|
+
/**
|
|
556
|
+
* @generated from field: uint64 resampler_handle = 1;
|
|
557
|
+
*/
|
|
558
|
+
resamplerHandle: bigint;
|
|
559
|
+
constructor(data?: PartialMessage<FlushSoxResamplerRequest>);
|
|
560
|
+
static readonly runtime: typeof proto3;
|
|
561
|
+
static readonly typeName = "livekit.proto.FlushSoxResamplerRequest";
|
|
562
|
+
static readonly fields: FieldList;
|
|
563
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FlushSoxResamplerRequest;
|
|
564
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): FlushSoxResamplerRequest;
|
|
565
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): FlushSoxResamplerRequest;
|
|
566
|
+
static equals(a: FlushSoxResamplerRequest | PlainMessage<FlushSoxResamplerRequest> | undefined, b: FlushSoxResamplerRequest | PlainMessage<FlushSoxResamplerRequest> | undefined): boolean;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* @generated from message livekit.proto.FlushSoxResamplerResponse
|
|
570
|
+
*/
|
|
571
|
+
export declare class FlushSoxResamplerResponse extends Message<FlushSoxResamplerResponse> {
|
|
572
|
+
/**
|
|
573
|
+
* *const i16 (could be null)
|
|
574
|
+
*
|
|
575
|
+
* @generated from field: uint64 output_ptr = 1;
|
|
576
|
+
*/
|
|
577
|
+
outputPtr: bigint;
|
|
578
|
+
/**
|
|
579
|
+
* in bytes
|
|
580
|
+
*
|
|
581
|
+
* @generated from field: uint32 size = 2;
|
|
582
|
+
*/
|
|
583
|
+
size: number;
|
|
584
|
+
/**
|
|
585
|
+
* @generated from field: optional string error = 3;
|
|
586
|
+
*/
|
|
587
|
+
error?: string;
|
|
588
|
+
constructor(data?: PartialMessage<FlushSoxResamplerResponse>);
|
|
589
|
+
static readonly runtime: typeof proto3;
|
|
590
|
+
static readonly typeName = "livekit.proto.FlushSoxResamplerResponse";
|
|
591
|
+
static readonly fields: FieldList;
|
|
592
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FlushSoxResamplerResponse;
|
|
593
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): FlushSoxResamplerResponse;
|
|
594
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): FlushSoxResamplerResponse;
|
|
595
|
+
static equals(a: FlushSoxResamplerResponse | PlainMessage<FlushSoxResamplerResponse> | undefined, b: FlushSoxResamplerResponse | PlainMessage<FlushSoxResamplerResponse> | undefined): boolean;
|
|
596
|
+
}
|
|
350
597
|
/**
|
|
351
598
|
* @generated from message livekit.proto.AudioFrameBufferInfo
|
|
352
599
|
*/
|
|
@@ -600,4 +847,38 @@ export declare class OwnedAudioResampler extends Message<OwnedAudioResampler> {
|
|
|
600
847
|
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): OwnedAudioResampler;
|
|
601
848
|
static equals(a: OwnedAudioResampler | PlainMessage<OwnedAudioResampler> | undefined, b: OwnedAudioResampler | PlainMessage<OwnedAudioResampler> | undefined): boolean;
|
|
602
849
|
}
|
|
850
|
+
/**
|
|
851
|
+
* @generated from message livekit.proto.SoxResamplerInfo
|
|
852
|
+
*/
|
|
853
|
+
export declare class SoxResamplerInfo extends Message<SoxResamplerInfo> {
|
|
854
|
+
constructor(data?: PartialMessage<SoxResamplerInfo>);
|
|
855
|
+
static readonly runtime: typeof proto3;
|
|
856
|
+
static readonly typeName = "livekit.proto.SoxResamplerInfo";
|
|
857
|
+
static readonly fields: FieldList;
|
|
858
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SoxResamplerInfo;
|
|
859
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SoxResamplerInfo;
|
|
860
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SoxResamplerInfo;
|
|
861
|
+
static equals(a: SoxResamplerInfo | PlainMessage<SoxResamplerInfo> | undefined, b: SoxResamplerInfo | PlainMessage<SoxResamplerInfo> | undefined): boolean;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* @generated from message livekit.proto.OwnedSoxResampler
|
|
865
|
+
*/
|
|
866
|
+
export declare class OwnedSoxResampler extends Message<OwnedSoxResampler> {
|
|
867
|
+
/**
|
|
868
|
+
* @generated from field: livekit.proto.FfiOwnedHandle handle = 1;
|
|
869
|
+
*/
|
|
870
|
+
handle?: FfiOwnedHandle;
|
|
871
|
+
/**
|
|
872
|
+
* @generated from field: livekit.proto.SoxResamplerInfo info = 2;
|
|
873
|
+
*/
|
|
874
|
+
info?: SoxResamplerInfo;
|
|
875
|
+
constructor(data?: PartialMessage<OwnedSoxResampler>);
|
|
876
|
+
static readonly runtime: typeof proto3;
|
|
877
|
+
static readonly typeName = "livekit.proto.OwnedSoxResampler";
|
|
878
|
+
static readonly fields: FieldList;
|
|
879
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): OwnedSoxResampler;
|
|
880
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): OwnedSoxResampler;
|
|
881
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): OwnedSoxResampler;
|
|
882
|
+
static equals(a: OwnedSoxResampler | PlainMessage<OwnedSoxResampler> | undefined, b: OwnedSoxResampler | PlainMessage<OwnedSoxResampler> | undefined): boolean;
|
|
883
|
+
}
|
|
603
884
|
//# sourceMappingURL=audio_frame_pb.d.ts.map
|