@relaymessenger/livekit 0.1.0-staging.1 → 0.1.0-staging.11
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/README.md +71 -12
- package/dist/engine-werift.d.ts +31 -0
- package/dist/engine-werift.d.ts.map +1 -1
- package/dist/engine-werift.js +247 -24
- package/dist/engine-werift.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/livekit.d.ts +43 -6
- package/dist/livekit.d.ts.map +1 -1
- package/dist/livekit.js +96 -27
- package/dist/livekit.js.map +1 -1
- package/dist/transport.d.ts +182 -10
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +707 -112
- package/dist/transport.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -39,10 +39,21 @@ async function answerCall(callId: string, session: AgentSession) {
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
`RelayLiveKitCall.connect()` does not resolve until the WebRTC media peer has
|
|
42
|
-
reached `connected`. `RelayAudioInput`
|
|
43
|
-
audio
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
reached `connected`. `RelayAudioInput` hands the AgentSession the remote
|
|
43
|
+
participant's audio as 24 kHz mono PCM16 frames, the format of LiveKit's own
|
|
44
|
+
room input; the Opus decoder produces that format directly.
|
|
45
|
+
|
|
46
|
+
`RelayAudioOutput` has the shape of LiveKit's own `ParticipantAudioOutput`:
|
|
47
|
+
`captureFrame()` hands the frame to the transport and returns at once, so the
|
|
48
|
+
AgentSession may push a whole reply faster than real time; the engine's 20 ms
|
|
49
|
+
pump paces the wire. `flush()` closes the segment and reports
|
|
50
|
+
`playbackFinished` only after the transport has drained. `clearBuffer()` drops
|
|
51
|
+
audio that has not reached the wire and reports the segment as interrupted at
|
|
52
|
+
the position that actually played.
|
|
53
|
+
|
|
54
|
+
On the transport, `writeAudio()` resolves once its 10 ms slices are queued,
|
|
55
|
+
`queuedAudioMs()` is what has not left yet, and `waitForPlayout()` resolves when
|
|
56
|
+
the queue is empty and the pump is idle (early on `clearAudio()`).
|
|
46
57
|
|
|
47
58
|
Use `setMuted(true)` to publish participant mute state, `end()` to end the Relay
|
|
48
59
|
Call, and `close()` for local cleanup. If the signaling connection is replaced,
|
|
@@ -63,6 +74,9 @@ const transport = new RelayCallTransport({ room });
|
|
|
63
74
|
transport.on("audio", ({ samples, sampleRate, channelCount }) => {
|
|
64
75
|
// Interleaved signed PCM16 from the remote Relay participant.
|
|
65
76
|
});
|
|
77
|
+
// Inbound audio is 48 kHz stereo unless you pass
|
|
78
|
+
// `inboundAudio: { sampleRate: 8000 | 12000 | 16000 | 24000 | 48000, channelCount: 1 | 2 }`;
|
|
79
|
+
// the `"wrtc"` engine accepts only the default.
|
|
66
80
|
|
|
67
81
|
await transport.connect();
|
|
68
82
|
await transport.writeAudio({
|
|
@@ -70,12 +84,17 @@ await transport.writeAudio({
|
|
|
70
84
|
sampleRate: 48_000,
|
|
71
85
|
channelCount: 1,
|
|
72
86
|
});
|
|
87
|
+
await transport.waitForPlayout();
|
|
73
88
|
```
|
|
74
89
|
|
|
75
90
|
## ICE servers, TURN, and diagnostics
|
|
76
91
|
|
|
77
|
-
By default the peer
|
|
78
|
-
|
|
92
|
+
By default the peer uses Cloudflare's STUN server
|
|
93
|
+
(`stun:stun.cloudflare.com:3478`), as Cloudflare's own Realtime echo example
|
|
94
|
+
does, and Cloudflare's SFU supplies its own candidates in the answer. The offer
|
|
95
|
+
leaves as soon as the first local candidate exists, without waiting for ICE
|
|
96
|
+
gathering to finish: the SFU is ICE-lite and learns the agent's address from
|
|
97
|
+
its connectivity checks. Inside a container or behind a firewall that
|
|
79
98
|
blocks outbound UDP, pass TURN servers in the standard `RTCIceServer` shape and,
|
|
80
99
|
if every path must go through TURN, `iceTransportPolicy: "relay"`. Both options
|
|
81
100
|
are accepted by `RelayLiveKitCall.connect()` and `RelayCallTransport`.
|
|
@@ -96,19 +115,59 @@ const call = await RelayLiveKitCall.connect({
|
|
|
96
115
|
},
|
|
97
116
|
],
|
|
98
117
|
iceTransportPolicy: "all",
|
|
99
|
-
mediaConnectTimeoutMs: 15_000,
|
|
100
118
|
});
|
|
101
119
|
```
|
|
102
120
|
|
|
103
|
-
`
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
`
|
|
121
|
+
`iceServers` may also be a function; it is called before every peer
|
|
122
|
+
connection, so it can mint fresh TURN credentials for each restart.
|
|
123
|
+
|
|
124
|
+
`connect()` resolves when media first reaches `connected`. It has no overall
|
|
125
|
+
deadline: when an SFU session is not `connected` within
|
|
126
|
+
`sessionConnectTimeoutMs` (5 seconds by default) of its answer, becomes
|
|
127
|
+
`failed`, or stays `disconnected` for 7 seconds, the transport closes that
|
|
128
|
+
peer, waits 250 ms (x1.1 per further attempt, at most 10 s), and publishes
|
|
129
|
+
from a new peer on a new session, for as long as the Call is ringing or in
|
|
130
|
+
progress. Outgoing audio keeps flowing into the new peer. `connect()` rejects
|
|
131
|
+
only when the Call ends, the room or transport closes, the room reports an
|
|
132
|
+
error, or the `signal` passed to it aborts. Each replacement emits
|
|
133
|
+
`restarted` with the reason and the replaced session's summary, for example
|
|
134
|
+
`local: host 2, srflx 0, relay 0; remote: udp 1473; states: new→complete 0.2s, connecting 0.3s, no connected; …`,
|
|
135
|
+
and `diagnostics().restarts` counts them. `mediaConnectTimeoutMs` and
|
|
136
|
+
`connectionTimeoutMs` are deprecated names for `sessionConnectTimeoutMs`.
|
|
137
|
+
|
|
138
|
+
`call.waitForPeerAudio(timeoutMs)` resolves once the person's audio has
|
|
139
|
+
arrived and the room shows them connected (the transport's `peerAudio` event);
|
|
140
|
+
start the agent's session after it so the first words are heard.
|
|
141
|
+
|
|
107
142
|
The same facts are available at any time from `call.diagnostics()` or
|
|
108
143
|
`transport.diagnostics()`: local candidate counts by type, the remote
|
|
109
144
|
candidates' transport and port (never their address), the ICE gathering, ICE
|
|
110
145
|
connection and peer connection state changes with their offsets from
|
|
111
|
-
`connect()`,
|
|
146
|
+
`connect()`, packet counts in both directions (`inbound`: RTP received, Opus
|
|
147
|
+
decode failures, PCM frames delivered, first and last packet offsets, packets
|
|
148
|
+
in the last 5 s; `outbound`: PCM frames accepted, Opus packets, RTP written
|
|
149
|
+
with the caller's audio, RTP written with silence, first and last packet
|
|
150
|
+
offsets, packets in the last 5 s, paced queue size, pacer state), the room frames seen (`roomState` count, pull `offer` count,
|
|
151
|
+
`ended` reason, `error` messages), and the one-line `summary`, for example
|
|
152
|
+
`…; in: 1234 rtp, 0 bad, 1234 frames, first 0.9s last 41.2s, 250/5s; out: 2600 frames, 1300 opus, 1300 rtp, silence 700, first 1.1s last 41.0s, 250/5s, queue 0, pacer alive; room: 3 roomState, 1 offer`.
|
|
153
|
+
Packet counts come from the `werift` engine; `wrtc` reports zero packets and
|
|
154
|
+
`pacer n/a`.
|
|
155
|
+
|
|
156
|
+
Like a live microphone, the `werift` engine's published track sends one Opus
|
|
157
|
+
packet every 20 ms from the moment media connects until the transport closes,
|
|
158
|
+
paced by the monotonic clock: a timer that fires late sends every packet due
|
|
159
|
+
by then, so the wire carries exactly 50 packets a second; a stall longer than
|
|
160
|
+
200 ms restarts the clock instead of bursting. The track carries
|
|
161
|
+
the caller's audio when some is queued, Opus silence otherwise. Cloudflare's
|
|
162
|
+
SFU will not let the person's side pull a track that has carried no RTP, so a
|
|
163
|
+
silent agent track would never be heard. Silence never counts toward
|
|
164
|
+
`queuedAudioMs()` or `waitForPlayout()`. The `wrtc` engine sends only the
|
|
165
|
+
audio written to it; write silence yourself if you use it.
|
|
166
|
+
|
|
167
|
+
`onWarning` is called once per call, with the summary, when outbound audio is
|
|
168
|
+
queued but no RTP packet has been written for 2 s while media is connected.
|
|
169
|
+
Nothing is restarted; the callback exists so the failing direction is named in
|
|
170
|
+
the agent's logs.
|
|
112
171
|
|
|
113
172
|
`RelayCallTransport` consumes the SDK's `CallRoom`; it does not duplicate the
|
|
114
173
|
room protocol. The default engine is `werift` (pure TypeScript WebRTC) with
|
package/dist/engine-werift.d.ts
CHANGED
|
@@ -6,6 +6,37 @@ export declare const WERIFT_CHANNEL_COUNT = 2;
|
|
|
6
6
|
/** One RTP packet carries 20 ms: 960 frames at 48 kHz, timestamp advances by 960. */
|
|
7
7
|
export declare const WERIFT_PACKET_MS = 20;
|
|
8
8
|
export type WeriftAudioSourceData = Parameters<RelayAudioSourceLike["onData"]>[0];
|
|
9
|
+
/** Packets counted for `diagnostics()`; the recent window is the last 5 s. */
|
|
10
|
+
export declare const STATS_WINDOW_MS = 5000;
|
|
11
|
+
/**
|
|
12
|
+
* A pacer more than this far behind its clock re-anchors instead of bursting
|
|
13
|
+
* the backlog. LiveKit's native `AudioSource` (rust-sdks
|
|
14
|
+
* webrtc-sys/src/audio_track.cpp:161-188) runs a 10 ms libwebrtc
|
|
15
|
+
* `RepeatingTask`, which schedules against an absolute run time and makes up
|
|
16
|
+
* every lost tick with zero delay, unbounded (rtc_base/task_utils/
|
|
17
|
+
* repeating_task.cc:86-89, `delay -= lost_time; delay = max(delay, 0)`). The
|
|
18
|
+
* bound is ours: 10 packets, so an event-loop hiccup is made up in full and a
|
|
19
|
+
* real stall does not dump seconds of audio on the receiver at once.
|
|
20
|
+
* Sources saved under _sources/audio-pacing-20260922.
|
|
21
|
+
*/
|
|
22
|
+
export declare const WERIFT_MAX_CATCH_UP_MS = 200;
|
|
23
|
+
/**
|
|
24
|
+
* Wall-clock RTP audio pacing: packet `n` of a run is due at `start + n × 20 ms`,
|
|
25
|
+
* so the average rate is exactly one packet per 20 ms however late the timer
|
|
26
|
+
* fires. `take(now)` returns how many packets are due and counts them as sent.
|
|
27
|
+
*/
|
|
28
|
+
export declare class RtpAudioPacer {
|
|
29
|
+
#private;
|
|
30
|
+
readonly packetMs: number;
|
|
31
|
+
readonly maxCatchUpMs: number;
|
|
32
|
+
constructor(packetMs?: number, maxCatchUpMs?: number);
|
|
33
|
+
/** Packets due by `now` and not yet sent; the first call of a run sends one at once. */
|
|
34
|
+
take(now: number): number;
|
|
35
|
+
/** When the next packet is due; `-Infinity` before the first `take` of a run. */
|
|
36
|
+
nextDueAt(): number;
|
|
37
|
+
/** Forget the run; the next `take` starts a new clock. */
|
|
38
|
+
reset(): void;
|
|
39
|
+
}
|
|
9
40
|
/** Convert any PCM16 frame to interleaved 48 kHz stereo by linear interpolation. */
|
|
10
41
|
export declare const toWireFormat: (data: {
|
|
11
42
|
samples: Int16Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-werift.d.ts","sourceRoot":"","sources":["../src/engine-werift.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine-werift.d.ts","sourceRoot":"","sources":["../src/engine-werift.ts"],"names":[],"mappings":"AAqCA,OAAO,EAGL,iBAAiB,EAIlB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAGV,oBAAoB,EAIpB,yBAAyB,EAEzB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,sGAAsG;AACtG,eAAO,MAAM,kBAAkB,QAAS,CAAC;AACzC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAMnC,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAElF,8EAA8E;AAC9E,eAAO,MAAM,eAAe,OAAQ,CAAC;AA8BrC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;GAIG;AACH,qBAAa,aAAa;;IAKtB,QAAQ,CAAC,QAAQ;IACjB,QAAQ,CAAC,YAAY;gBADZ,QAAQ,SAAmB,EAC3B,YAAY,SAAyB;IAGhD,wFAAwF;IACxF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAWzB,iFAAiF;IACjF,SAAS,IAAI,MAAM;IAInB,0DAA0D;IAC1D,KAAK,IAAI,IAAI;CAId;AAED,oFAAoF;AACpF,eAAO,MAAM,YAAY,GAAI,MAAM;IACjC,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,KAAG,UAwBH,CAAC;AA4QF,eAAO,MAAM,0BAA0B,GACrC,SAAQ,yBAAyE,KAChF,iBAeC,CAAC;AAEL,eAAO,MAAM,yBAAyB,QAAO,kBAI3C,CAAC"}
|
package/dist/engine-werift.js
CHANGED
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
* offsets sequenceNumber/timestamp, so the local track starts both at 0.
|
|
22
22
|
* - ../../rtp/src/codec/opus.d.ts: `OpusRtpPayload.deSerialize(buffer)`.
|
|
23
23
|
* - node_modules/@evan/opus/lib.d.ts: `Encoder.encode(pcm16)` returns one Opus
|
|
24
|
-
* packet; `Decoder.decode(packet)` returns interleaved PCM16 bytes
|
|
24
|
+
* packet; `Decoder.decode(packet)` returns interleaved PCM16 bytes;
|
|
25
|
+
* `new Decoder({ channels?: 1 | 2, sample_rate?: 8000 | 12000 | 16000 |
|
|
26
|
+
* 24000 | 48000 })` decodes any Opus stream to that count and rate (libopus
|
|
27
|
+
* `opus_decoder_create(Fs, channels)`), which is how the sink honours
|
|
28
|
+
* `RelayInboundAudioFormat`.
|
|
25
29
|
* Participant shapes copied from the headless phone that joined Relay's room
|
|
26
30
|
* through Cloudflare's SFU on 2026-09-21 (_runtime/bin/headless-phone-webrtc.mjs
|
|
27
31
|
* lines 93-160): `bundlePolicy: "max-bundle", iceServers: []` (Cloudflare
|
|
@@ -41,6 +45,82 @@ const PACKET_FRAMES = (WERIFT_SAMPLE_RATE * WERIFT_PACKET_MS) / 1000;
|
|
|
41
45
|
const PACKET_SAMPLES = PACKET_FRAMES * WERIFT_CHANNEL_COUNT;
|
|
42
46
|
/** Dynamic payload type; werift's sender replaces it with the negotiated one. */
|
|
43
47
|
const LOCAL_PAYLOAD_TYPE = 111;
|
|
48
|
+
/** Packets counted for `diagnostics()`; the recent window is the last 5 s. */
|
|
49
|
+
export const STATS_WINDOW_MS = 5_000;
|
|
50
|
+
/** Monotone packet counter with first/last epoch timestamps and a 5 s window. */
|
|
51
|
+
class PacketClock {
|
|
52
|
+
count = 0;
|
|
53
|
+
firstAt;
|
|
54
|
+
lastAt;
|
|
55
|
+
#recent = [];
|
|
56
|
+
mark(now = Date.now()) {
|
|
57
|
+
this.count += 1;
|
|
58
|
+
this.firstAt ??= now;
|
|
59
|
+
this.lastAt = now;
|
|
60
|
+
this.#recent.push(now);
|
|
61
|
+
this.#prune(now);
|
|
62
|
+
}
|
|
63
|
+
recent(now = Date.now()) {
|
|
64
|
+
this.#prune(now);
|
|
65
|
+
return this.#recent.length;
|
|
66
|
+
}
|
|
67
|
+
#prune(now) {
|
|
68
|
+
const floor = now - STATS_WINDOW_MS;
|
|
69
|
+
let drop = 0;
|
|
70
|
+
while (drop < this.#recent.length && this.#recent[drop] < floor)
|
|
71
|
+
drop += 1;
|
|
72
|
+
if (drop)
|
|
73
|
+
this.#recent.splice(0, drop);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A pacer more than this far behind its clock re-anchors instead of bursting
|
|
78
|
+
* the backlog. LiveKit's native `AudioSource` (rust-sdks
|
|
79
|
+
* webrtc-sys/src/audio_track.cpp:161-188) runs a 10 ms libwebrtc
|
|
80
|
+
* `RepeatingTask`, which schedules against an absolute run time and makes up
|
|
81
|
+
* every lost tick with zero delay, unbounded (rtc_base/task_utils/
|
|
82
|
+
* repeating_task.cc:86-89, `delay -= lost_time; delay = max(delay, 0)`). The
|
|
83
|
+
* bound is ours: 10 packets, so an event-loop hiccup is made up in full and a
|
|
84
|
+
* real stall does not dump seconds of audio on the receiver at once.
|
|
85
|
+
* Sources saved under _sources/audio-pacing-20260922.
|
|
86
|
+
*/
|
|
87
|
+
export const WERIFT_MAX_CATCH_UP_MS = 200;
|
|
88
|
+
/**
|
|
89
|
+
* Wall-clock RTP audio pacing: packet `n` of a run is due at `start + n × 20 ms`,
|
|
90
|
+
* so the average rate is exactly one packet per 20 ms however late the timer
|
|
91
|
+
* fires. `take(now)` returns how many packets are due and counts them as sent.
|
|
92
|
+
*/
|
|
93
|
+
export class RtpAudioPacer {
|
|
94
|
+
packetMs;
|
|
95
|
+
maxCatchUpMs;
|
|
96
|
+
#startedAt;
|
|
97
|
+
#sent = 0;
|
|
98
|
+
constructor(packetMs = WERIFT_PACKET_MS, maxCatchUpMs = WERIFT_MAX_CATCH_UP_MS) {
|
|
99
|
+
this.packetMs = packetMs;
|
|
100
|
+
this.maxCatchUpMs = maxCatchUpMs;
|
|
101
|
+
}
|
|
102
|
+
/** Packets due by `now` and not yet sent; the first call of a run sends one at once. */
|
|
103
|
+
take(now) {
|
|
104
|
+
if (this.#startedAt === undefined || now - this.nextDueAt() > this.maxCatchUpMs) {
|
|
105
|
+
this.#startedAt = now;
|
|
106
|
+
this.#sent = 0;
|
|
107
|
+
}
|
|
108
|
+
const due = Math.floor((now - this.#startedAt) / this.packetMs) + 1 - this.#sent;
|
|
109
|
+
if (due <= 0)
|
|
110
|
+
return 0;
|
|
111
|
+
this.#sent += due;
|
|
112
|
+
return due;
|
|
113
|
+
}
|
|
114
|
+
/** When the next packet is due; `-Infinity` before the first `take` of a run. */
|
|
115
|
+
nextDueAt() {
|
|
116
|
+
return this.#startedAt === undefined ? -Infinity : this.#startedAt + this.#sent * this.packetMs;
|
|
117
|
+
}
|
|
118
|
+
/** Forget the run; the next `take` starts a new clock. */
|
|
119
|
+
reset() {
|
|
120
|
+
this.#startedAt = undefined;
|
|
121
|
+
this.#sent = 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
44
124
|
/** Convert any PCM16 frame to interleaved 48 kHz stereo by linear interpolation. */
|
|
45
125
|
export const toWireFormat = (data) => {
|
|
46
126
|
const { samples, sampleRate, channelCount } = data;
|
|
@@ -69,8 +149,25 @@ export const toWireFormat = (data) => {
|
|
|
69
149
|
};
|
|
70
150
|
/**
|
|
71
151
|
* PCM16 in, paced 20 ms Opus RTP out. Frames are accumulated into whole
|
|
72
|
-
* packets;
|
|
73
|
-
*
|
|
152
|
+
* packets; an `RtpAudioPacer` on the monotonic clock decides how many are
|
|
153
|
+
* due, so the wire sees exactly 50 packets/s regardless of how the adapter
|
|
154
|
+
* chunks its writes or how late the timer fires. A timer that fired once per
|
|
155
|
+
* packet (the old `setInterval`) lost every late tick while the RTP timestamp
|
|
156
|
+
* still advanced 960 per packet: @relay's calls on 2026-09-22 sent 48.66-48.98
|
|
157
|
+
* packets/s and the phone's jitter buffer ran dry. Adapters may push
|
|
158
|
+
* far ahead of real time: `queuedMs()` is what has not left yet and
|
|
159
|
+
* `waitForDrain()` resolves once the queued application audio has been
|
|
160
|
+
* written (LiveKit's `AudioSource.queuedDuration` / `waitForPlayout` shape).
|
|
161
|
+
*
|
|
162
|
+
* From `start()` (the transport calls it when the peer first connects) until
|
|
163
|
+
* the track stops, the pump never pauses: a tick with no application audio
|
|
164
|
+
* queued writes an Opus silence frame instead, as a live microphone track
|
|
165
|
+
* does. Cloudflare's SFU refuses to pull a published track that has carried
|
|
166
|
+
* no RTP: `tracks/new` for the remote track returned `empty_track_error` "No
|
|
167
|
+
* track data from remote peer" after about 8.2 s on staging 2026-09-22, and
|
|
168
|
+
* the same pull returned in about 470 ms with silence flowing. Silence and
|
|
169
|
+
* application packets share one sequence and timestamp line, so queued audio
|
|
170
|
+
* replaces silence on the next tick with no gap and no jump.
|
|
74
171
|
*/
|
|
75
172
|
class WeriftAudioSource {
|
|
76
173
|
#encoder = new Encoder({
|
|
@@ -78,26 +175,70 @@ class WeriftAudioSource {
|
|
|
78
175
|
sample_rate: WERIFT_SAMPLE_RATE,
|
|
79
176
|
application: "voip",
|
|
80
177
|
});
|
|
178
|
+
/** 20 ms of digital silence, encoded once by the same encoder and reused. */
|
|
179
|
+
#silence = Buffer.from(this.#encoder.encode(new Int16Array(PACKET_SAMPLES)));
|
|
81
180
|
#track = new MediaStreamTrack({ kind: "audio", id: "microphone", streamId: "relay-call" });
|
|
82
181
|
#packets = [];
|
|
182
|
+
/** Every RTP packet written, silence included. */
|
|
183
|
+
#rtp = new PacketClock();
|
|
184
|
+
#opusPackets = 0;
|
|
185
|
+
#applicationRtpPackets = 0;
|
|
186
|
+
#silencePackets = 0;
|
|
83
187
|
#pending = new Int16Array(0);
|
|
84
188
|
#sequenceNumber = 1;
|
|
85
189
|
#timestamp = 0;
|
|
86
190
|
#first = true;
|
|
87
191
|
#pump;
|
|
192
|
+
#pacer = new RtpAudioPacer();
|
|
193
|
+
#started = false;
|
|
88
194
|
#stopped = false;
|
|
195
|
+
#drainWaiters = new Set();
|
|
196
|
+
stats() {
|
|
197
|
+
return {
|
|
198
|
+
opusPackets: this.#opusPackets,
|
|
199
|
+
rtpPackets: this.#applicationRtpPackets,
|
|
200
|
+
silencePackets: this.#silencePackets,
|
|
201
|
+
firstRtpAt: this.#rtp.firstAt,
|
|
202
|
+
lastRtpAt: this.#rtp.lastAt,
|
|
203
|
+
recentRtpPackets: this.#rtp.recent(),
|
|
204
|
+
queued: this.#packets.length,
|
|
205
|
+
pacerAlive: this.#pump !== undefined,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
89
208
|
createTrack() {
|
|
90
209
|
const track = this.#track;
|
|
91
210
|
const stop = track.stop;
|
|
92
211
|
track.stop = () => {
|
|
93
212
|
this.#stopped = true;
|
|
94
|
-
this
|
|
95
|
-
this.#pending = new Int16Array(0);
|
|
213
|
+
this.clear();
|
|
96
214
|
this.#stopPump();
|
|
97
215
|
stop();
|
|
98
216
|
};
|
|
99
217
|
return track;
|
|
100
218
|
}
|
|
219
|
+
start() {
|
|
220
|
+
if (this.#started || this.#stopped)
|
|
221
|
+
return;
|
|
222
|
+
this.#started = true;
|
|
223
|
+
this.#startPump();
|
|
224
|
+
}
|
|
225
|
+
queuedMs() {
|
|
226
|
+
return this.#packets.length * WERIFT_PACKET_MS
|
|
227
|
+
+ (this.#pending.length / WERIFT_CHANNEL_COUNT / WERIFT_SAMPLE_RATE) * 1_000;
|
|
228
|
+
}
|
|
229
|
+
waitForDrain() {
|
|
230
|
+
this.#flushPending();
|
|
231
|
+
if (this.#drained())
|
|
232
|
+
return Promise.resolve();
|
|
233
|
+
return new Promise((resolve) => this.#drainWaiters.add(resolve));
|
|
234
|
+
}
|
|
235
|
+
clear() {
|
|
236
|
+
this.#packets.length = 0;
|
|
237
|
+
this.#pending = new Int16Array(0);
|
|
238
|
+
if (!this.#started)
|
|
239
|
+
this.#stopPump();
|
|
240
|
+
this.#notifyDrained();
|
|
241
|
+
}
|
|
101
242
|
onData(data) {
|
|
102
243
|
if (this.#stopped)
|
|
103
244
|
return;
|
|
@@ -109,34 +250,85 @@ class WeriftAudioSource {
|
|
|
109
250
|
while (merged.length - offset >= PACKET_SAMPLES) {
|
|
110
251
|
const frame = merged.subarray(offset, offset + PACKET_SAMPLES);
|
|
111
252
|
this.#packets.push(Buffer.from(this.#encoder.encode(frame)));
|
|
253
|
+
this.#opusPackets += 1;
|
|
112
254
|
offset += PACKET_SAMPLES;
|
|
113
255
|
}
|
|
114
256
|
this.#pending = merged.slice(offset);
|
|
115
257
|
this.#startPump();
|
|
116
258
|
}
|
|
259
|
+
/** Pad a sub-packet remainder with silence so the tail of a segment reaches the wire. */
|
|
260
|
+
#flushPending() {
|
|
261
|
+
if (this.#stopped || this.#pending.length === 0)
|
|
262
|
+
return;
|
|
263
|
+
const padded = new Int16Array(PACKET_SAMPLES);
|
|
264
|
+
padded.set(this.#pending);
|
|
265
|
+
this.#pending = new Int16Array(0);
|
|
266
|
+
this.#packets.push(Buffer.from(this.#encoder.encode(padded)));
|
|
267
|
+
this.#opusPackets += 1;
|
|
268
|
+
this.#startPump();
|
|
269
|
+
}
|
|
270
|
+
/** Application audio only: the silence the started pump keeps writing never counts. */
|
|
271
|
+
#drained() {
|
|
272
|
+
return this.#packets.length === 0
|
|
273
|
+
&& this.#pending.length === 0
|
|
274
|
+
&& (this.#started || this.#pump === undefined);
|
|
275
|
+
}
|
|
276
|
+
#notifyDrained() {
|
|
277
|
+
if (!this.#drained())
|
|
278
|
+
return;
|
|
279
|
+
for (const resolve of [...this.#drainWaiters]) {
|
|
280
|
+
this.#drainWaiters.delete(resolve);
|
|
281
|
+
resolve();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The first packet of a run leaves at once; after that each wake sends
|
|
286
|
+
* every packet the pacer says is due and sleeps until the next one is due,
|
|
287
|
+
* the absolute schedule of libwebrtc's `RepeatingTask`. Before `start()` the
|
|
288
|
+
* pump stops once the queue is empty; after it, the pump runs until the
|
|
289
|
+
* track stops.
|
|
290
|
+
*/
|
|
117
291
|
#startPump() {
|
|
118
|
-
if (this.#pump || this.#
|
|
292
|
+
if (this.#pump || this.#stopped)
|
|
119
293
|
return;
|
|
120
|
-
this.#
|
|
121
|
-
|
|
294
|
+
if (!this.#started && this.#packets.length === 0)
|
|
295
|
+
return;
|
|
296
|
+
this.#tick();
|
|
297
|
+
}
|
|
298
|
+
#tick() {
|
|
299
|
+
if (this.#stopped)
|
|
122
300
|
return;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (this.#
|
|
301
|
+
const due = this.#pacer.take(performance.now());
|
|
302
|
+
for (let sent = 0; sent < due; sent += 1) {
|
|
303
|
+
if (!this.#sendNext())
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
if (this.#packets.length === 0) {
|
|
307
|
+
if (!this.#started) {
|
|
126
308
|
this.#stopPump();
|
|
127
|
-
|
|
309
|
+
this.#notifyDrained();
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this.#notifyDrained();
|
|
313
|
+
}
|
|
314
|
+
const delay = Math.max(0, Math.ceil(this.#pacer.nextDueAt() - performance.now()));
|
|
315
|
+
this.#pump = setTimeout(() => this.#tick(), delay);
|
|
128
316
|
this.#pump.unref?.();
|
|
129
317
|
}
|
|
130
318
|
#stopPump() {
|
|
319
|
+
this.#pacer.reset();
|
|
131
320
|
if (!this.#pump)
|
|
132
321
|
return;
|
|
133
|
-
|
|
322
|
+
clearTimeout(this.#pump);
|
|
134
323
|
this.#pump = undefined;
|
|
135
324
|
}
|
|
325
|
+
/** Writes one packet, queued audio first, else silence once started; false when nothing was written. */
|
|
136
326
|
#sendNext() {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
327
|
+
if (this.#stopped)
|
|
328
|
+
return false;
|
|
329
|
+
const application = this.#packets.shift();
|
|
330
|
+
if (!application && !this.#started)
|
|
331
|
+
return false;
|
|
140
332
|
const header = new RtpHeader({
|
|
141
333
|
payloadType: LOCAL_PAYLOAD_TYPE,
|
|
142
334
|
sequenceNumber: this.#sequenceNumber,
|
|
@@ -147,16 +339,36 @@ class WeriftAudioSource {
|
|
|
147
339
|
this.#first = false;
|
|
148
340
|
this.#sequenceNumber = (this.#sequenceNumber + 1) & 0xffff;
|
|
149
341
|
this.#timestamp = (this.#timestamp + PACKET_FRAMES) >>> 0;
|
|
150
|
-
this.#track.writeRtp(new RtpPacket(header,
|
|
342
|
+
this.#track.writeRtp(new RtpPacket(header, application ?? this.#silence));
|
|
343
|
+
if (application)
|
|
344
|
+
this.#applicationRtpPackets += 1;
|
|
345
|
+
else
|
|
346
|
+
this.#silencePackets += 1;
|
|
347
|
+
this.#rtp.mark();
|
|
348
|
+
return true;
|
|
151
349
|
}
|
|
152
350
|
}
|
|
153
|
-
/** Opus RTP in, PCM16 (48 kHz stereo) out, one `ondata` per packet. */
|
|
351
|
+
/** Opus RTP in, PCM16 in the requested format (default 48 kHz stereo) out, one `ondata` per packet. */
|
|
154
352
|
class WeriftAudioSink {
|
|
155
353
|
ondata = null;
|
|
156
|
-
#decoder
|
|
354
|
+
#decoder;
|
|
355
|
+
#rtp = new PacketClock();
|
|
356
|
+
#decodeFailures = 0;
|
|
157
357
|
#unsubscribe;
|
|
158
|
-
|
|
358
|
+
stats() {
|
|
359
|
+
return {
|
|
360
|
+
rtpPackets: this.#rtp.count,
|
|
361
|
+
decodeFailures: this.#decodeFailures,
|
|
362
|
+
firstRtpAt: this.#rtp.firstAt,
|
|
363
|
+
lastRtpAt: this.#rtp.lastAt,
|
|
364
|
+
recentRtpPackets: this.#rtp.recent(),
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
constructor(track, format = { sampleRate: WERIFT_SAMPLE_RATE, channelCount: WERIFT_CHANNEL_COUNT }) {
|
|
368
|
+
const { sampleRate, channelCount } = format;
|
|
369
|
+
this.#decoder = new Decoder({ channels: channelCount, sample_rate: sampleRate });
|
|
159
370
|
const { unSubscribe } = track.onReceiveRtp.subscribe((rtp) => {
|
|
371
|
+
this.#rtp.mark();
|
|
160
372
|
const handler = this.ondata;
|
|
161
373
|
if (!handler || !rtp.payload?.length)
|
|
162
374
|
return;
|
|
@@ -166,16 +378,17 @@ class WeriftAudioSink {
|
|
|
166
378
|
bytes = this.#decoder.decode(packet.payload);
|
|
167
379
|
}
|
|
168
380
|
catch {
|
|
381
|
+
this.#decodeFailures += 1;
|
|
169
382
|
return;
|
|
170
383
|
}
|
|
171
384
|
const samples = new Int16Array(bytes.byteLength >> 1);
|
|
172
385
|
new Uint8Array(samples.buffer).set(bytes.subarray(0, samples.byteLength));
|
|
173
386
|
handler({
|
|
174
387
|
samples,
|
|
175
|
-
sampleRate
|
|
388
|
+
sampleRate,
|
|
176
389
|
bitsPerSample: 16,
|
|
177
|
-
channelCount
|
|
178
|
-
numberOfFrames: samples.length /
|
|
390
|
+
channelCount,
|
|
391
|
+
numberOfFrames: samples.length / channelCount,
|
|
179
392
|
});
|
|
180
393
|
});
|
|
181
394
|
this.#unsubscribe = unSubscribe;
|
|
@@ -185,6 +398,15 @@ class WeriftAudioSink {
|
|
|
185
398
|
this.#unsubscribe();
|
|
186
399
|
}
|
|
187
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* Video codecs the peer can accept in a pull offer. Nothing decodes video: the
|
|
403
|
+
* transport only answers the person's `video` m-line receive-only and ignores
|
|
404
|
+
* the track (PROTOCOL.md section 5). werift matches a remote codec by MIME
|
|
405
|
+
* type alone (`findCodecByMimeType` in `TransceiverManager.setRemoteRTP`) and
|
|
406
|
+
* throws "negotiate codecs failed." for a media section with no local codec
|
|
407
|
+
* of its kind, so an audio-only codec list cannot answer a video m-line.
|
|
408
|
+
*/
|
|
409
|
+
const RECEIVE_VIDEO_MIME_TYPES = ["video/VP8", "video/VP9", "video/H264", "video/AV1"];
|
|
188
410
|
export const createWeriftPeerConnection = (config = { iceServers: [], iceTransportPolicy: "all" }) => new RTCPeerConnection({
|
|
189
411
|
bundlePolicy: "max-bundle",
|
|
190
412
|
iceServers: config.iceServers,
|
|
@@ -197,11 +419,12 @@ export const createWeriftPeerConnection = (config = { iceServers: [], iceTranspo
|
|
|
197
419
|
channels: WERIFT_CHANNEL_COUNT,
|
|
198
420
|
}),
|
|
199
421
|
],
|
|
422
|
+
video: RECEIVE_VIDEO_MIME_TYPES.map((mimeType) => new RTCRtpCodecParameters({ mimeType, clockRate: 90_000 })),
|
|
200
423
|
},
|
|
201
424
|
});
|
|
202
425
|
export const createWeriftWebRTCFactory = () => ({
|
|
203
426
|
createPeerConnection: (config) => createWeriftPeerConnection(config),
|
|
204
427
|
createAudioSource: () => new WeriftAudioSource(),
|
|
205
|
-
createAudioSink: (track) => new WeriftAudioSink(track),
|
|
428
|
+
createAudioSink: (track, format) => new WeriftAudioSink(track, format),
|
|
206
429
|
});
|
|
207
430
|
//# sourceMappingURL=engine-werift.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-werift.js","sourceRoot":"","sources":["../src/engine-werift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,c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E,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAC9D,EAAE,CACrB,IAAI,iBAAiB,CAAC;IACpB,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,MAAM,CAAC,UAAU;IAC7B,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;IAC7C,MAAM,EAAE;QACN,KAAK,EAAE;YACL,IAAI,qBAAqB,CAAC;gBACxB,QAAQ,EAAE,YAAY;gBACtB,SAAS,EAAE,kBAAkB;gBAC7B,QAAQ,EAAE,oBAAoB;aAC/B,CAAC;SACH;QACD,KAAK,EAAE,wBAAwB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;KAC9G;CACF,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAuB,EAAE,CAAC,CAAC;IAClE,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,0BAA0B,CAAC,MAAM,CAAuC;IAC1G,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,iBAAiB,EAAE;IAChD,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,KAAoC,EAAE,MAAM,CAAC;CACtG,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { RelayAudioInput, RelayAudioOutput, RelayLiveKitCall, createRelayLiveKitAudio, type RelayLiveKitAudio, type RelayLiveKitAudioOptions, type RelayLiveKitConnectOptions, } from "./livekit.js";
|
|
2
|
-
export { RelayCallTransport, RelayCallTransportError, type RelayAudioFrame, type RelayCallEngine, type RelayCallIceDiagnostics, type RelayCallTransportCloseEvent, type RelayCallTransportOptions, type RelayIceServer, type RelayIceTransportPolicy, } from "./transport.js";
|
|
1
|
+
export { RelayAudioInput, RelayAudioOutput, LIVEKIT_ROOM_INPUT_AUDIO, RelayLiveKitCall, createRelayLiveKitAudio, type RelayLiveKitAudio, type RelayLiveKitAudioOptions, type RelayLiveKitConnectOptions, } from "./livekit.js";
|
|
2
|
+
export { RelayCallTransport, RelayCallTransportError, type RelayAudioFrame, type RelayCallEngine, type RelayCallIceDiagnostics, type RelayCallInboundDiagnostics, type RelayCallOutboundDiagnostics, type RelayCallRestartEvent, type RelayCallRestartReason, type RelayCallRoomDiagnostics, type RelayCallTransportCloseEvent, type RelayCallTransportOptions, type RelayIceServer, type RelayIceServersProvider, type RelayIceTransportPolicy, type RelayInboundAudioFormat, } from "./transport.js";
|
|
3
3
|
export { createWeriftWebRTCFactory } from "./engine-werift.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { RelayAudioInput, RelayAudioOutput, RelayLiveKitCall, createRelayLiveKitAudio, } from "./livekit.js";
|
|
1
|
+
export { RelayAudioInput, RelayAudioOutput, LIVEKIT_ROOM_INPUT_AUDIO, RelayLiveKitCall, createRelayLiveKitAudio, } from "./livekit.js";
|
|
2
2
|
export { RelayCallTransport, RelayCallTransportError, } from "./transport.js";
|
|
3
3
|
export { createWeriftWebRTCFactory } from "./engine-werift.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,GAIxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,GAIxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,GAexB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
|