Skip to content
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5515699
fix: get rid of DataTrackHandle wrapping class and make it just a number
1egoman Feb 2, 2026
80d9044
fix: make Future<T, E> promise property use Throws
1egoman Feb 2, 2026
9443cef
docs: add Future docs comment
1egoman Feb 6, 2026
6ef565f
feat: add initial incoming data tracks manager draft
1egoman Feb 6, 2026
712c779
feat: add initial data track pipeline for local data track (named inc…
1egoman Feb 6, 2026
ec5330d
refactor: rename from incoming -> outgoing which I think is actually …
1egoman Feb 6, 2026
762706b
feat: wire together local data track <-> outgoing manager
1egoman Feb 9, 2026
098101a
fix: update existing tests to get them to pass again
1egoman Feb 9, 2026
e0946e3
feat: add initial outgoing data track manager tests
1egoman Feb 9, 2026
d7fec15
refactor: separate out outgoing events
1egoman Feb 9, 2026
2c001a0
feat: get outgoing data tracks manager mostly tested
1egoman Feb 9, 2026
7d14094
refactor: move events into separate file
1egoman Feb 9, 2026
d8a787f
fix: run npm run format
1egoman Feb 9, 2026
2fd3eaa
feat: add data track publish timeout after 10s
1egoman Feb 9, 2026
0129c66
feat: add in outgoing manager shutdown test
1egoman Feb 9, 2026
c923d7c
fix: add a few FIXME comments to further ponder
1egoman Feb 9, 2026
6b3b653
refactor: move away fully from the manager input events pattern
1egoman Feb 10, 2026
899b0a8
refactor: move subscribeToEvents into its own file
1egoman Feb 10, 2026
44fd5cd
refactor: move all errors into separate errors file
1egoman Feb 10, 2026
f582982
refactor: rename DataTrackOutgoingManager -> OutgoingDataTrackManager
1egoman Feb 10, 2026
df8ba23
fix: add missing import
1egoman Feb 10, 2026
35bf3d5
feat: add missing Throw error brands
1egoman Feb 10, 2026
fd64eb4
feat: add support for try/catch bare rethrowing to throws-transformer
1egoman Feb 10, 2026
69c4561
fix: add missing throws branding
1egoman Feb 10, 2026
424438e
fix: add throws ignore due to introduction of throws in Future
1egoman Feb 10, 2026
98819fa
fox: run npm run format
1egoman Feb 10, 2026
3a85e17
fix: remove unneeded error descriminator
1egoman Feb 10, 2026
379ee00
fix: run npm run lint
1egoman Feb 10, 2026
dd43cfe
feat: add packet encryption test
1egoman Feb 10, 2026
87ae505
fix: add missing changeset
1egoman Feb 10, 2026
fe7e649
fix: swap index import from packetizer -> OutgoingDataTrackManager
1egoman Feb 10, 2026
3087238
fix: push empty commit to try to get the coderabbit bot to review
1egoman Feb 10, 2026
2991109
feat: add unpublishing descriptor shutdown case
1egoman Feb 10, 2026
5d40107
fix: add more error cases
1egoman Feb 10, 2026
1827635
docs: clarify docs comment
1egoman Feb 10, 2026
12aa217
fix: add missing error cases
1egoman Feb 10, 2026
9f852e5
feat: make assertions read a little better
1egoman Feb 11, 2026
a90dfb9
feat: send unpublish event explicitly on cancellation
1egoman Feb 11, 2026
060155d
feat: remove publishing descriptor type, instead add unpublishingFutu…
1egoman Feb 13, 2026
0b97e14
feat: get rid of lagging missing unpublishing case
1egoman Feb 13, 2026
878d5c6
feat: remove fixmes that have been addressed
1egoman Feb 20, 2026
aea83e5
fix: remove options from tryProcessAndSend
1egoman Feb 20, 2026
2b70c4c
fix: remove options from tryPush and remove Throws type from public i…
1egoman Feb 20, 2026
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
5 changes: 5 additions & 0 deletions .changeset/thin-jobs-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

Adds new OutgoingDataTrackManager to manage sending data track payloads
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as attributes from './room/attribute-typings';
// FIXME: remove this import in a follow up data track pull request.
import './room/data-track/depacketizer';
// FIXME: remove this import in a follow up data track pull request.
import './room/data-track/packetizer';
import './room/data-track/outgoing/OutgoingDataTrackManager';
import LocalParticipant from './room/participant/LocalParticipant';
import Participant, { ConnectionQuality, ParticipantKind } from './room/participant/Participant';
import type { ParticipantTrackPermission } from './room/participant/ParticipantTrackPermission';
Expand Down
2 changes: 1 addition & 1 deletion src/room/data-track/depacketizer.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { DataTrackDepacketizer } from './depacketizer';
import DataTrackDepacketizer from './depacketizer';
import { DataTrackHandle } from './handle';
import { DataTrackPacket, DataTrackPacketHeader, FrameMarker } from './packet';
import { DataTrackTimestamp, WrapAroundUnsignedInt } from './utils';
Expand Down
2 changes: 1 addition & 1 deletion src/room/data-track/depacketizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type PushOptions = {
errorOnPartialFrames: boolean;
};

export class DataTrackDepacketizer {
export default class DataTrackDepacketizer {
/** Maximum number of packets to buffer per frame before dropping. */
static MAX_BUFFER_PACKETS = 128;

Expand Down
14 changes: 14 additions & 0 deletions src/room/data-track/e2ee.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export type EncryptedPayload = {
payload: Uint8Array;
iv: Uint8Array; // NOTE: should be 12 bytes long
keyIndex: number;
};

export type EncryptionProvider = {
// FIXME: add in explicit `Throws<..., EncryptionError>`?
encrypt(payload: Uint8Array): EncryptedPayload;
};

export type DecryptionProvider = {
decrypt(payload: Uint8Array, senderIdentity: string): Uint8Array;
};
2 changes: 1 addition & 1 deletion src/room/data-track/frame.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataTrackExtensions } from './packet/extensions';
import { DataTrackPacketizer } from './packetizer';
import DataTrackPacketizer from './packetizer';

/** A pair of payload bytes and packet extensions which can be fed into a {@link DataTrackPacketizer}. */
export type DataTrackFrame = {
Expand Down
2 changes: 1 addition & 1 deletion src/room/data-track/handle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DataTrackHandle } from './handle';

describe('DataTrackHandle', () => {
it('should parse handle raw inputs', () => {
expect(DataTrackHandle.fromNumber(3).value).toEqual(3);
expect(DataTrackHandle.fromNumber(3)).toEqual(3);
expect(() => DataTrackHandle.fromNumber(0)).toThrow('0x0 is a reserved value');
expect(() => DataTrackHandle.fromNumber(9999999)).toThrow(
'Value too large to be a valid track handle',
Expand Down
23 changes: 9 additions & 14 deletions src/room/data-track/handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ export class DataTrackHandleError<
}
}

export class DataTrackHandle {
public value: number;

static fromNumber(
export type DataTrackHandle = number;
export const DataTrackHandle = {
fromNumber(
raw: number,
): Throws<
DataTrackHandle,
Expand All @@ -57,24 +56,20 @@ export class DataTrackHandle {
if (raw > U16_MAX_SIZE) {
throw DataTrackHandleError.tooLarge();
}
return new DataTrackHandle(raw);
}

constructor(raw: number) {
this.value = raw;
}
}
return raw;
},
};

/** Manage allocating new handles which don't conflict over the lifetime of the client. */
export class DataTrackHandleAllocator {
static value = 0;
value = 0;

/** Returns a unique track handle for the next publication, if one can be obtained. */
static get(): DataTrackHandle | null {
get(): DataTrackHandle | null {
this.value += 1;
if (this.value > U16_MAX_SIZE) {
return null;
}
return new DataTrackHandle(this.value);
return this.value;
}
}
Loading
Loading