Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/livekit-rtc/generate_proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ PATH=$PATH:$(pwd)/node_modules/.bin \
$FFI_PROTOCOL/e2ee.proto \
$FFI_PROTOCOL/stats.proto \
$FFI_PROTOCOL/rpc.proto \
$FFI_PROTOCOL/track_publication.proto
$FFI_PROTOCOL/track_publication.proto \
$FFI_PROTOCOL/data_stream.proto
4 changes: 4 additions & 0 deletions packages/livekit-rtc/src/audio_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface AudioStreamOptions {
noiseCancellation?: NoiseCancellationOptions;
sampleRate?: number;
numChannels?: number;
frameSizeMs?: number;
}

export interface NoiseCancellationOptions {
Expand All @@ -26,6 +27,7 @@ class AudioStreamSource implements UnderlyingSource<AudioFrame> {
private sampleRate: number;
private numChannels: number;
private ncOptions?: NoiseCancellationOptions;
private frameSizeMs?: number;

constructor(
track: Track,
Expand All @@ -36,6 +38,7 @@ class AudioStreamSource implements UnderlyingSource<AudioFrame> {
this.sampleRate = sampleRateOrOptions.sampleRate ?? 48000;
this.numChannels = sampleRateOrOptions.numChannels ?? 1;
this.ncOptions = sampleRateOrOptions.noiseCancellation;
this.frameSizeMs = sampleRateOrOptions.frameSizeMs;
} else {
this.sampleRate = (sampleRateOrOptions as number) ?? 48000;
this.numChannels = numChannels ?? 1;
Expand All @@ -46,6 +49,7 @@ class AudioStreamSource implements UnderlyingSource<AudioFrame> {
trackHandle: track.ffi_handle.handle,
sampleRate: this.sampleRate,
numChannels: this.numChannels,
frameSizeMs: this.frameSizeMs,
...(this.ncOptions
? {
audioFilterModuleId: this.ncOptions.moduleId,
Expand Down
12 changes: 12 additions & 0 deletions packages/livekit-rtc/src/proto/audio_frame_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ export class NewAudioStreamRequest extends Message<NewAudioStreamRequest> {
*/
audioFilterOptions?: string;

/**
* @generated from field: optional uint32 frame_size_ms = 7;
*/
frameSizeMs?: number;

constructor(data?: PartialMessage<NewAudioStreamRequest>) {
super();
proto2.util.initPartial(data, this);
Expand All @@ -225,6 +230,7 @@ export class NewAudioStreamRequest extends Message<NewAudioStreamRequest> {
{ no: 4, name: "num_channels", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
{ no: 5, name: "audio_filter_module_id", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 6, name: "audio_filter_options", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 7, name: "frame_size_ms", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): NewAudioStreamRequest {
Expand Down Expand Up @@ -320,6 +326,11 @@ export class AudioStreamFromParticipantRequest extends Message<AudioStreamFromPa
*/
audioFilterOptions?: string;

/**
* @generated from field: optional uint32 frame_size_ms = 9;
*/
frameSizeMs?: number;

constructor(data?: PartialMessage<AudioStreamFromParticipantRequest>) {
super();
proto2.util.initPartial(data, this);
Expand All @@ -335,6 +346,7 @@ export class AudioStreamFromParticipantRequest extends Message<AudioStreamFromPa
{ no: 6, name: "num_channels", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
{ no: 7, name: "audio_filter_module_id", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 8, name: "audio_filter_options", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 9, name: "frame_size_ms", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AudioStreamFromParticipantRequest {
Expand Down
Loading
Loading