@caprid/moq-media 0.0.0 → 0.1.0
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/LICENSE +20 -0
- package/NOTICE +6 -0
- package/README.md +187 -2
- package/UPSTREAM.json +19 -0
- package/dist/audio-player.d.ts +206 -0
- package/dist/audio-player.d.ts.map +1 -0
- package/dist/audio-player.js +480 -0
- package/dist/audio-player.js.map +1 -0
- package/dist/audio-worklet.d.ts +64 -0
- package/dist/audio-worklet.d.ts.map +1 -0
- package/dist/audio-worklet.js +355 -0
- package/dist/audio-worklet.js.map +1 -0
- package/dist/catalog.d.ts +141 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +174 -0
- package/dist/catalog.js.map +1 -0
- package/dist/clock.d.ts +178 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +190 -0
- package/dist/clock.js.map +1 -0
- package/dist/echo-loopback.d.ts +38 -0
- package/dist/echo-loopback.d.ts.map +1 -0
- package/dist/echo-loopback.js +100 -0
- package/dist/echo-loopback.js.map +1 -0
- package/dist/h264.d.ts +4 -0
- package/dist/h264.d.ts.map +1 -0
- package/dist/h264.js +8 -0
- package/dist/h264.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/interrupt.d.ts +35 -0
- package/dist/interrupt.d.ts.map +1 -0
- package/dist/interrupt.js +44 -0
- package/dist/interrupt.js.map +1 -0
- package/dist/loc.d.ts +55 -0
- package/dist/loc.d.ts.map +1 -0
- package/dist/loc.js +74 -0
- package/dist/loc.js.map +1 -0
- package/dist/parse-catalog.d.ts +81 -0
- package/dist/parse-catalog.d.ts.map +1 -0
- package/dist/parse-catalog.js +134 -0
- package/dist/parse-catalog.js.map +1 -0
- package/dist/render-clock.d.ts +38 -0
- package/dist/render-clock.d.ts.map +1 -0
- package/dist/render-clock.js +40 -0
- package/dist/render-clock.js.map +1 -0
- package/dist/sequencer.d.ts +130 -0
- package/dist/sequencer.d.ts.map +1 -0
- package/dist/sequencer.js +599 -0
- package/dist/sequencer.js.map +1 -0
- package/dist/source.d.ts +21 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +54 -0
- package/dist/source.js.map +1 -0
- package/dist/timeline.d.ts +69 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +83 -0
- package/dist/timeline.js.map +1 -0
- package/dist/transcript.d.ts +84 -0
- package/dist/transcript.d.ts.map +1 -0
- package/dist/transcript.js +151 -0
- package/dist/transcript.js.map +1 -0
- package/dist/webcodecs.d.ts +32 -0
- package/dist/webcodecs.d.ts.map +1 -0
- package/dist/webcodecs.js +79 -0
- package/dist/webcodecs.js.map +1 -0
- package/package.json +34 -4
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The audio player's jitter buffer: an `AudioWorkletProcessor` holding one input's decoded audio in a ring. It is
|
|
3
|
+
* written as a function so it is type-checked, and shipped as that function's source: an `AudioWorklet` loads a
|
|
4
|
+
* module by URL, and a package cannot name a file URL every bundler resolves. So the function references nothing
|
|
5
|
+
* outside itself, not even a constant; the tests run the same source.
|
|
6
|
+
*/
|
|
7
|
+
/** The processor name `AUDIO_PLAYER_WORKLET_SOURCE` registers. */
|
|
8
|
+
export const AUDIO_PLAYER_PROCESSOR = 'caprid-audio-player-input';
|
|
9
|
+
function audioPlayerWorklet(name) {
|
|
10
|
+
const ms = (value) => Math.round((value * sampleRate) / 1000);
|
|
11
|
+
/** At most this much audio is held: past it, everything held is dropped. */
|
|
12
|
+
const CAPACITY = ms(4000);
|
|
13
|
+
/** Timestamps closer than this to the expected one are contiguous. */
|
|
14
|
+
const TOLERANCE_US = 1000;
|
|
15
|
+
/** A gap inside held audio up to this long is filled with silence; a longer one is joined without it. */
|
|
16
|
+
const MAX_CONCEAL = ms(1000);
|
|
17
|
+
/** After an underrun the target grows this much; after `SHRINK_AFTER` with none it shrinks by `SHRINK_STEP`. */
|
|
18
|
+
const GROW_STEP = ms(20);
|
|
19
|
+
const SHRINK_STEP = ms(10);
|
|
20
|
+
const SHRINK_AFTER = ms(8000);
|
|
21
|
+
/** Each window, held audio that never dipped to the target is trimmed back to it, when the excess is this much. */
|
|
22
|
+
const TRIM_WINDOW = ms(1000);
|
|
23
|
+
const MIN_TRIM = ms(10);
|
|
24
|
+
/** The hard bound on held audio: twice the target plus this, and never past the ceiling. */
|
|
25
|
+
const HARD_HEADROOM = ms(60);
|
|
26
|
+
const REPORT_EVERY = ms(20);
|
|
27
|
+
class AudioPlayerInput extends AudioWorkletProcessor {
|
|
28
|
+
ring;
|
|
29
|
+
/**
|
|
30
|
+
* Samples ever written and read: the ring holds `written − read` of them. The read position is `read + phase`:
|
|
31
|
+
* at a playback rate other than 1, output falls between held samples, and `phase` (0 ≤ phase < 1) carries the
|
|
32
|
+
* fraction across quanta and rate changes.
|
|
33
|
+
*/
|
|
34
|
+
written = 0;
|
|
35
|
+
read = 0;
|
|
36
|
+
phase = 0;
|
|
37
|
+
rate;
|
|
38
|
+
segments = [];
|
|
39
|
+
playing = false;
|
|
40
|
+
target;
|
|
41
|
+
minTarget;
|
|
42
|
+
maxTarget;
|
|
43
|
+
/** Frames of silence output since the buffer ran dry while playing; `undefined` when it has not. */
|
|
44
|
+
dry;
|
|
45
|
+
/** Where it ran dry, until playback starts again. */
|
|
46
|
+
dryAtUs = null;
|
|
47
|
+
playStarts = 0;
|
|
48
|
+
smooth = 0;
|
|
49
|
+
window = 0;
|
|
50
|
+
lowWater = Number.POSITIVE_INFINITY;
|
|
51
|
+
sinceReport = 0;
|
|
52
|
+
stopped = false;
|
|
53
|
+
underruns = 0;
|
|
54
|
+
trimmed = 0;
|
|
55
|
+
concealed = 0;
|
|
56
|
+
cut = 0;
|
|
57
|
+
/**
|
|
58
|
+
* Cuts that no audio from their start on has arrived after yet, disjoint and in order. The hole before that audio
|
|
59
|
+
* is the range cut out where it falls in a cut, and joins without silence there. Audio still decoding from before
|
|
60
|
+
* a cut's start can land first, and leaves it pending.
|
|
61
|
+
*/
|
|
62
|
+
pendingCuts = [];
|
|
63
|
+
constructor(options) {
|
|
64
|
+
super();
|
|
65
|
+
const { channels, targetFrames, minTargetFrames, maxTargetFrames, playbackRate } = options.processorOptions;
|
|
66
|
+
this.rate = playbackRate;
|
|
67
|
+
this.ring = Array.from({ length: channels }, () => new Float32Array(CAPACITY));
|
|
68
|
+
this.minTarget = minTargetFrames;
|
|
69
|
+
this.maxTarget = Math.max(minTargetFrames, maxTargetFrames);
|
|
70
|
+
this.target = Math.min(this.maxTarget, Math.max(minTargetFrames, targetFrames));
|
|
71
|
+
this.port.onmessage = (event) => this.command(event.data);
|
|
72
|
+
}
|
|
73
|
+
get buffered() {
|
|
74
|
+
return this.written - this.read;
|
|
75
|
+
}
|
|
76
|
+
command(command) {
|
|
77
|
+
if (command.type === 'pcm')
|
|
78
|
+
this.push(command.timestampUs, command.planes);
|
|
79
|
+
else if (command.type === 'flush')
|
|
80
|
+
this.flush();
|
|
81
|
+
else if (command.type === 'cut')
|
|
82
|
+
this.cutRange(command.fromUs, command.untilUs);
|
|
83
|
+
else if (command.type === 'ceiling') {
|
|
84
|
+
this.maxTarget = Math.max(this.minTarget, command.maxTargetFrames);
|
|
85
|
+
this.target = Math.min(this.target, this.maxTarget);
|
|
86
|
+
}
|
|
87
|
+
else if (command.type === 'rate')
|
|
88
|
+
this.rate = command.playbackRate;
|
|
89
|
+
else
|
|
90
|
+
this.stopped = true;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The timestamp of sample `index`, held or the next to be written, plus `fraction` of a sample; silence written for
|
|
94
|
+
* a gap continues its run.
|
|
95
|
+
*/
|
|
96
|
+
timestampAt(index, fraction = 0) {
|
|
97
|
+
let segment = this.segments[0];
|
|
98
|
+
for (const candidate of this.segments) {
|
|
99
|
+
if (candidate.start > index)
|
|
100
|
+
break;
|
|
101
|
+
segment = candidate;
|
|
102
|
+
}
|
|
103
|
+
return segment.timestampUs + Math.round(((index + fraction - segment.start) * 1_000_000) / sampleRate);
|
|
104
|
+
}
|
|
105
|
+
/** The index of the first held sample whose timestamp is at or after `timestampUs`; `written` when none is. */
|
|
106
|
+
indexOf(timestampUs) {
|
|
107
|
+
for (let at = 0; at < this.segments.length; at++) {
|
|
108
|
+
const segment = this.segments[at];
|
|
109
|
+
const end = this.segments[at + 1]?.start ?? this.written;
|
|
110
|
+
const offset = Math.max(0, Math.ceil(((timestampUs - segment.timestampUs) * sampleRate) / 1_000_000));
|
|
111
|
+
const index = Math.max(this.read, segment.start + offset);
|
|
112
|
+
if (index < end)
|
|
113
|
+
return index;
|
|
114
|
+
}
|
|
115
|
+
return this.written;
|
|
116
|
+
}
|
|
117
|
+
write(source, frames) {
|
|
118
|
+
for (let channel = 0; channel < this.ring.length; channel++) {
|
|
119
|
+
const ring = this.ring[channel];
|
|
120
|
+
const plane = source(channel);
|
|
121
|
+
for (let offset = 0; offset < frames; offset++) {
|
|
122
|
+
ring[(this.written + offset) % CAPACITY] = plane ? (plane[offset] ?? 0) : 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this.written += frames;
|
|
126
|
+
}
|
|
127
|
+
push(timestampUs, planes) {
|
|
128
|
+
const frames = planes[0]?.length ?? 0;
|
|
129
|
+
if (frames === 0)
|
|
130
|
+
return;
|
|
131
|
+
if (this.dry !== undefined) {
|
|
132
|
+
// Audio came back after the buffer ran dry. Soon enough, and a deeper buffer would have covered it; later, it
|
|
133
|
+
// was the sender's silence, which no buffer covers.
|
|
134
|
+
if (this.dry <= this.maxTarget) {
|
|
135
|
+
this.underruns++;
|
|
136
|
+
this.smooth = 0;
|
|
137
|
+
this.target = Math.min(this.maxTarget, this.target + GROW_STEP);
|
|
138
|
+
}
|
|
139
|
+
this.dry = undefined;
|
|
140
|
+
}
|
|
141
|
+
const expectedUs = this.buffered > 0 ? this.timestampAt(this.written) : undefined;
|
|
142
|
+
// The cuts this audio is past: the part of the hole before it that they cover was cut out, not lost.
|
|
143
|
+
let cutOutUs = 0;
|
|
144
|
+
this.pendingCuts = this.pendingCuts.filter((cut) => {
|
|
145
|
+
if (cut.fromUs > timestampUs)
|
|
146
|
+
return true;
|
|
147
|
+
if (expectedUs !== undefined) {
|
|
148
|
+
cutOutUs += Math.max(0, Math.min(timestampUs, cut.untilUs) - Math.max(expectedUs, cut.fromUs));
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
});
|
|
152
|
+
if (expectedUs !== undefined) {
|
|
153
|
+
// A frame that never came, inside held audio: silence keeps the rest on time.
|
|
154
|
+
const lostUs = timestampUs - expectedUs - cutOutUs;
|
|
155
|
+
const gap = Math.round((lostUs * sampleRate) / 1_000_000);
|
|
156
|
+
if (lostUs > TOLERANCE_US && gap <= MAX_CONCEAL && this.buffered + gap + frames <= CAPACITY) {
|
|
157
|
+
this.write(() => undefined, gap);
|
|
158
|
+
this.concealed += gap;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (this.buffered + frames > CAPACITY)
|
|
162
|
+
this.dropTo(this.written, true);
|
|
163
|
+
this.segments.push({ start: this.written, timestampUs });
|
|
164
|
+
this.write((channel) => planes[channel] ?? planes[0], frames);
|
|
165
|
+
}
|
|
166
|
+
/** Drop everything held, and any cut still pending: what comes next starts a new timeline. */
|
|
167
|
+
flush() {
|
|
168
|
+
this.pendingCuts = [];
|
|
169
|
+
this.dropTo(this.written, false);
|
|
170
|
+
// Already empty, as after running dry: still forget the replaced timeline's dry point.
|
|
171
|
+
this.emptied();
|
|
172
|
+
}
|
|
173
|
+
/** Drop held samples before `index`: as trimmed (latency shed) or as a flush. */
|
|
174
|
+
dropTo(index, trim) {
|
|
175
|
+
const count = index - this.read;
|
|
176
|
+
if (count <= 0)
|
|
177
|
+
return;
|
|
178
|
+
if (trim)
|
|
179
|
+
this.trimmed += count;
|
|
180
|
+
this.read = index;
|
|
181
|
+
this.prune();
|
|
182
|
+
if (this.buffered === 0)
|
|
183
|
+
this.emptied();
|
|
184
|
+
}
|
|
185
|
+
/** Nothing is held because it was dropped, not played: fill to the target again, and count no underrun. */
|
|
186
|
+
emptied() {
|
|
187
|
+
this.playing = false;
|
|
188
|
+
this.dry = undefined;
|
|
189
|
+
this.dryAtUs = null;
|
|
190
|
+
this.phase = 0;
|
|
191
|
+
this.segments = [];
|
|
192
|
+
}
|
|
193
|
+
prune() {
|
|
194
|
+
while (this.segments.length > 1 && this.segments[1].start <= this.read)
|
|
195
|
+
this.segments.shift();
|
|
196
|
+
}
|
|
197
|
+
/** Remove held samples whose timestamps fall in [fromUs, untilUs). */
|
|
198
|
+
cutRange(fromUs, untilUs) {
|
|
199
|
+
// Audio still decoding lands after the cut, held audio or not: never fill the range with silence. Overlapping
|
|
200
|
+
// cuts merge, so no part of a hole counts twice.
|
|
201
|
+
const cuts = [
|
|
202
|
+
...this.pendingCuts,
|
|
203
|
+
{ fromUs: fromUs ?? Number.NEGATIVE_INFINITY, untilUs: untilUs ?? Number.POSITIVE_INFINITY },
|
|
204
|
+
].sort((a, b) => (a.fromUs < b.fromUs ? -1 : a.fromUs > b.fromUs ? 1 : 0));
|
|
205
|
+
this.pendingCuts = [];
|
|
206
|
+
for (const cut of cuts) {
|
|
207
|
+
const last = this.pendingCuts[this.pendingCuts.length - 1];
|
|
208
|
+
if (last && cut.fromUs <= last.untilUs)
|
|
209
|
+
last.untilUs = Math.max(last.untilUs, cut.untilUs);
|
|
210
|
+
else
|
|
211
|
+
this.pendingCuts.push({ ...cut });
|
|
212
|
+
}
|
|
213
|
+
if (this.buffered === 0)
|
|
214
|
+
return;
|
|
215
|
+
const start = fromUs === null ? this.read : this.indexOf(fromUs);
|
|
216
|
+
const end = untilUs === null ? this.written : this.indexOf(untilUs);
|
|
217
|
+
if (end <= start)
|
|
218
|
+
return;
|
|
219
|
+
const count = end - start;
|
|
220
|
+
this.cut += count;
|
|
221
|
+
const endTimestampUs = end < this.written ? this.timestampAt(end) : undefined;
|
|
222
|
+
// Move what follows the cut back over it.
|
|
223
|
+
for (let channel = 0; channel < this.ring.length; channel++) {
|
|
224
|
+
const ring = this.ring[channel];
|
|
225
|
+
for (let index = end; index < this.written; index++) {
|
|
226
|
+
ring[(index - count) % CAPACITY] = ring[index % CAPACITY];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const kept = this.segments.filter((segment) => segment.start < start);
|
|
230
|
+
if (endTimestampUs !== undefined)
|
|
231
|
+
kept.push({ start, timestampUs: endTimestampUs });
|
|
232
|
+
for (const segment of this.segments) {
|
|
233
|
+
if (segment.start > end)
|
|
234
|
+
kept.push({ start: segment.start - count, timestampUs: segment.timestampUs });
|
|
235
|
+
}
|
|
236
|
+
this.segments = kept;
|
|
237
|
+
this.written -= count;
|
|
238
|
+
if (this.buffered === 0)
|
|
239
|
+
this.emptied();
|
|
240
|
+
}
|
|
241
|
+
process(_inputs, outputs) {
|
|
242
|
+
if (this.stopped)
|
|
243
|
+
return false;
|
|
244
|
+
const output = outputs[0] ?? [];
|
|
245
|
+
const frames = output[0]?.length ?? 128;
|
|
246
|
+
if (!this.playing && this.buffered >= this.target) {
|
|
247
|
+
this.playing = true;
|
|
248
|
+
this.playStarts++;
|
|
249
|
+
this.dryAtUs = null;
|
|
250
|
+
this.lowWater = this.buffered;
|
|
251
|
+
this.window = 0;
|
|
252
|
+
}
|
|
253
|
+
let timestampUs = null;
|
|
254
|
+
if (this.playing) {
|
|
255
|
+
const hard = Math.max(this.target, Math.min(2 * this.target + HARD_HEADROOM, this.maxTarget));
|
|
256
|
+
if (this.buffered > hard)
|
|
257
|
+
this.dropTo(this.written - hard, true);
|
|
258
|
+
}
|
|
259
|
+
if (this.playing) {
|
|
260
|
+
// Output `offset` reads position `phase + offset × rate` past `read`, between two held samples: as many as
|
|
261
|
+
// stay at or before the newest one.
|
|
262
|
+
const { rate, phase } = this;
|
|
263
|
+
const last = this.buffered - 1 - phase;
|
|
264
|
+
const available = last < 0 ? 0 : Math.min(frames, Math.floor(last / rate) + 1);
|
|
265
|
+
timestampUs = this.timestampAt(this.read, phase);
|
|
266
|
+
for (let channel = 0; channel < output.length; channel++) {
|
|
267
|
+
const ring = this.ring[Math.min(channel, this.ring.length - 1)];
|
|
268
|
+
const out = output[channel];
|
|
269
|
+
if (rate === 1 && phase === 0) {
|
|
270
|
+
for (let offset = 0; offset < available; offset++)
|
|
271
|
+
out[offset] = ring[(this.read + offset) % CAPACITY];
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
for (let offset = 0; offset < available; offset++) {
|
|
275
|
+
const at = phase + offset * rate;
|
|
276
|
+
const whole = Math.floor(at);
|
|
277
|
+
const fraction = at - whole;
|
|
278
|
+
const a = ring[(this.read + whole) % CAPACITY];
|
|
279
|
+
const b = fraction === 0 ? a : ring[(this.read + whole + 1) % CAPACITY];
|
|
280
|
+
out[offset] = a + (b - a) * fraction;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
out.fill(0, available);
|
|
284
|
+
}
|
|
285
|
+
// Rate 2 can step one sample past the newest: the position stops there.
|
|
286
|
+
const advance = phase + available * rate;
|
|
287
|
+
const whole = Math.min(Math.floor(advance), this.buffered);
|
|
288
|
+
this.read += whole;
|
|
289
|
+
this.phase = whole === Math.floor(advance) ? advance - whole : 0;
|
|
290
|
+
if (this.buffered === 0)
|
|
291
|
+
this.phase = 0;
|
|
292
|
+
this.prune();
|
|
293
|
+
if (available < frames) {
|
|
294
|
+
// Ran dry: wait for the target again. Whether it counts as an underrun is known when audio comes back. Off rate
|
|
295
|
+
// 1, less than a sample can be left, past the read position: it was played, as at rate 1.
|
|
296
|
+
this.playing = false;
|
|
297
|
+
this.dry = frames - available;
|
|
298
|
+
this.read = this.written;
|
|
299
|
+
this.phase = 0;
|
|
300
|
+
this.dryAtUs = this.timestampAt(this.read);
|
|
301
|
+
this.segments = [];
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
this.lowWater = Math.min(this.lowWater, this.buffered);
|
|
305
|
+
this.smooth += frames;
|
|
306
|
+
this.window += frames;
|
|
307
|
+
if (this.window >= TRIM_WINDOW) {
|
|
308
|
+
// Held audio that never dipped to the target over a whole window is delay nobody needed.
|
|
309
|
+
// Not below rate 1, which gains that delay on purpose: only the hard bound limits it then.
|
|
310
|
+
const excess = this.lowWater - this.target;
|
|
311
|
+
if (excess >= MIN_TRIM && this.rate >= 1)
|
|
312
|
+
this.dropTo(this.read + excess, true);
|
|
313
|
+
this.window = 0;
|
|
314
|
+
this.lowWater = this.buffered;
|
|
315
|
+
}
|
|
316
|
+
if (this.smooth >= SHRINK_AFTER) {
|
|
317
|
+
this.target = Math.max(this.minTarget, this.target - SHRINK_STEP);
|
|
318
|
+
this.smooth = 0;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
for (const out of output)
|
|
324
|
+
out.fill(0);
|
|
325
|
+
if (this.dry !== undefined)
|
|
326
|
+
this.dry += frames;
|
|
327
|
+
}
|
|
328
|
+
this.sinceReport += frames;
|
|
329
|
+
if (this.sinceReport >= REPORT_EVERY) {
|
|
330
|
+
this.sinceReport = 0;
|
|
331
|
+
const report = {
|
|
332
|
+
frame: currentFrame,
|
|
333
|
+
rendered: currentFrame + frames,
|
|
334
|
+
timestampUs,
|
|
335
|
+
playing: this.playing,
|
|
336
|
+
playStarts: this.playStarts,
|
|
337
|
+
heldUntilUs: this.buffered > 0 ? this.timestampAt(this.written) : null,
|
|
338
|
+
dryAtUs: this.dryAtUs,
|
|
339
|
+
bufferedFrames: this.buffered,
|
|
340
|
+
targetFrames: this.target,
|
|
341
|
+
underruns: this.underruns,
|
|
342
|
+
trimmedFrames: this.trimmed,
|
|
343
|
+
concealedFrames: this.concealed,
|
|
344
|
+
cutFrames: this.cut,
|
|
345
|
+
};
|
|
346
|
+
this.port.postMessage(report);
|
|
347
|
+
}
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
registerProcessor(name, AudioPlayerInput);
|
|
352
|
+
}
|
|
353
|
+
/** The worklet module's source. */
|
|
354
|
+
export const AUDIO_PLAYER_WORKLET_SOURCE = `(${audioPlayerWorklet.toString()})(${JSON.stringify(AUDIO_PLAYER_PROCESSOR)});`;
|
|
355
|
+
//# sourceMappingURL=audio-worklet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-worklet.js","sourceRoot":"","sources":["../src/audio-worklet.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAqDlE,SAAS,kBAAkB,CAAC,IAAY;IAOtC,MAAM,EAAE,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IACtE,4EAA4E;IAC5E,MAAM,QAAQ,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1B,sEAAsE;IACtE,MAAM,YAAY,GAAG,IAAI,CAAC;IAC1B,yGAAyG;IACzG,MAAM,WAAW,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC7B,gHAAgH;IAChH,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACzB,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,YAAY,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC9B,mHAAmH;IACnH,MAAM,WAAW,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACxB,4FAA4F;IAC5F,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7B,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAE5B,MAAM,gBAAiB,SAAQ,qBAAqB;QACzC,IAA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 +1,141 @@
|
|
|
1
|
+
/** Version emitted — the newest version `parseMsfCatalog` accepts. */
|
|
2
|
+
export declare const MSF_CATALOG_VERSION = "draft-01";
|
|
3
|
+
/**
|
|
4
|
+
* The video track {@link buildMsfCatalog} advertises. An H.264 (`avc1`/`avc3`) track without `initData` is left out
|
|
5
|
+
* of the catalog, since its codec string is derived from the avcC record.
|
|
6
|
+
*/
|
|
7
|
+
export interface VideoTrackInfo {
|
|
8
|
+
/** Track name. Default {@link VIDEO_TRACK}. */
|
|
9
|
+
name?: string;
|
|
10
|
+
/** WebCodecs registry codec string, e.g. `'avc1.42E01F'` or `'vp8'`. */
|
|
11
|
+
codec: string;
|
|
12
|
+
/** Coded width in pixels. */
|
|
13
|
+
width?: number;
|
|
14
|
+
/** Coded height in pixels. */
|
|
15
|
+
height?: number;
|
|
16
|
+
/** Frames per second. */
|
|
17
|
+
framerate?: number;
|
|
18
|
+
/** Bits per second. */
|
|
19
|
+
bitrate?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Decoder init data (WebCodecs `decoderConfig.description`, e.g. avcC for `avc`-format H.264) — emitted as an inline
|
|
22
|
+
* `initDataList` entry referenced by the track's `initRef`.
|
|
23
|
+
*/
|
|
24
|
+
initData?: Uint8Array;
|
|
25
|
+
/**
|
|
26
|
+
* Render group (msf-01 §5.2.11): tracks sharing one play together on one timeline. Default 1; give a second source,
|
|
27
|
+
* such as a screen share and its audio, its own.
|
|
28
|
+
*/
|
|
29
|
+
renderGroup?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Alternate group (msf-01 §5.2.12): tracks sharing one are alternate versions of the same content, such as simulcast
|
|
32
|
+
* layers, and a viewer subscribes to one of them. Members share a role and a render group.
|
|
33
|
+
*/
|
|
34
|
+
altGroup?: number;
|
|
35
|
+
}
|
|
36
|
+
/** The audio track {@link buildMsfCatalog} advertises. Unset fields default to Opus, 48 kHz, stereo. */
|
|
37
|
+
export interface AudioTrackInfo {
|
|
38
|
+
/** Track name. Default {@link AUDIO_TRACK}. */
|
|
39
|
+
name?: string;
|
|
40
|
+
/** WebCodecs registry codec string, e.g. `'opus'`. */
|
|
41
|
+
codec?: string;
|
|
42
|
+
/** Output sample rate (§5.2.20). Always 48000 for Opus. */
|
|
43
|
+
samplerate?: number;
|
|
44
|
+
/** Channel config string (§5.2.21), e.g. `'2'` or `'5.1'`. */
|
|
45
|
+
channelConfig?: string;
|
|
46
|
+
/** Bits per second. */
|
|
47
|
+
bitrate?: number;
|
|
48
|
+
/** Decoder init data, e.g. an AAC AudioSpecificConfig — Opus carries none. */
|
|
49
|
+
initData?: Uint8Array;
|
|
50
|
+
/**
|
|
51
|
+
* Render group (msf-01 §5.2.11): tracks sharing one play together on one timeline. Default 1; give a second source,
|
|
52
|
+
* such as a screen share and its audio, its own.
|
|
53
|
+
*/
|
|
54
|
+
renderGroup?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Alternate group (msf-01 §5.2.12): tracks sharing one are alternate versions of the same content, such as simulcast
|
|
57
|
+
* layers, and a viewer subscribes to one of them. Members share a role and a render group.
|
|
58
|
+
*/
|
|
59
|
+
altGroup?: number;
|
|
60
|
+
}
|
|
61
|
+
/** One entry of {@link MsfCatalogInput.media}: a video or audio track, tagged with its MSF role. */
|
|
62
|
+
export type MediaTrackInfo = ({
|
|
63
|
+
/** MSF role (§5.2.6) of the entry. */
|
|
64
|
+
role: 'video';
|
|
65
|
+
} & VideoTrackInfo) | ({
|
|
66
|
+
/** MSF role (§5.2.6) of the entry. */
|
|
67
|
+
role: 'audio';
|
|
68
|
+
} & AudioTrackInfo);
|
|
69
|
+
/** A non-media track {@link buildMsfCatalog} advertises, such as application data. */
|
|
70
|
+
export interface DataTrackInfo {
|
|
71
|
+
/** Track name, unique within the catalog. */
|
|
72
|
+
name: string;
|
|
73
|
+
/**
|
|
74
|
+
* MSF role label (§5.2.6) classifying the non-media track for consumers, e.g. `'data'` or `'metadata'`. MUST NOT be a
|
|
75
|
+
* media role: the entry carries no codec or media fields, so a media role would round-trip into an undecodable
|
|
76
|
+
* renderable track. The builder rejects these roles.
|
|
77
|
+
*/
|
|
78
|
+
role?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The Media Timeline track (msf-01 §7) {@link buildMsfCatalog} announces. The entry is listed only while a track it
|
|
82
|
+
* depends on is listed; see spec/media-layer.md, "Media Timeline track".
|
|
83
|
+
*/
|
|
84
|
+
export interface MediaTimelineTrackInfo {
|
|
85
|
+
/** Track name. Default {@link MEDIA_TIMELINE_TRACK}. */
|
|
86
|
+
name?: string;
|
|
87
|
+
/**
|
|
88
|
+
* The video and audio tracks the timeline applies to (§5.2.14, §7.2); its locations point into the first. Default:
|
|
89
|
+
* the first video track, then the first audio track, whichever exist.
|
|
90
|
+
*/
|
|
91
|
+
depends?: readonly string[];
|
|
92
|
+
}
|
|
93
|
+
/** What {@link buildMsfCatalog} advertises: the namespace and the tracks published under it. */
|
|
94
|
+
export interface MsfCatalogInput {
|
|
95
|
+
/** Track namespace tuple every track is published under. */
|
|
96
|
+
namespace: readonly string[];
|
|
97
|
+
/** A video track, if any: shorthand for a one-entry {@link media} list, listed first. */
|
|
98
|
+
video?: VideoTrackInfo;
|
|
99
|
+
/** An audio track, if any: shorthand for a one-entry {@link media} list, listed after `video`. */
|
|
100
|
+
audio?: AudioTrackInfo;
|
|
101
|
+
/**
|
|
102
|
+
* Video and audio tracks, listed in this order after `video` and `audio`: simulcast layers sharing an `altGroup`,
|
|
103
|
+
* or several sources in their own render groups.
|
|
104
|
+
*/
|
|
105
|
+
media?: readonly MediaTrackInfo[];
|
|
106
|
+
/**
|
|
107
|
+
* Application data tracks published beside the media — advertised so consumers can discover and subscribe to them,
|
|
108
|
+
* but carrying none of the media fields (`mediaKindOf` on the parse side classifies them as non-renderable
|
|
109
|
+
* plumbing).
|
|
110
|
+
*/
|
|
111
|
+
data?: readonly DataTrackInfo[];
|
|
112
|
+
/** The Media Timeline track that maps the broadcast's media time to wall-clock time, if any. */
|
|
113
|
+
mediaTimeline?: MediaTimelineTrackInfo;
|
|
114
|
+
/** Catalog generation time (§5.2.24), epoch milliseconds. */
|
|
115
|
+
generatedAt?: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Build the publisher's independent MSF catalog JSON for a live broadcast.
|
|
119
|
+
*
|
|
120
|
+
* The catalog leaves `isComplete` out: msf-01 §5.1.3 forbids it while false, and once present it can never be
|
|
121
|
+
* removed. End a broadcast with {@link buildMsfEndCatalog}.
|
|
122
|
+
*
|
|
123
|
+
* Namespaces are emitted explicitly per track as the slash-joined string form `parseMsfCatalog` splits back into
|
|
124
|
+
* tuple fields — the catalog dialect's encoding, which msf-01 leaves open, so the pair stays self-consistent whatever
|
|
125
|
+
* the drafts settle on.
|
|
126
|
+
*/
|
|
127
|
+
export declare function buildMsfCatalog(input: MsfCatalogInput): Uint8Array;
|
|
128
|
+
/** What {@link buildMsfEndCatalog} stamps on the end-of-broadcast catalog. */
|
|
129
|
+
export interface MsfEndCatalogInput {
|
|
130
|
+
/** Catalog generation time (§5.2.24), epoch milliseconds. */
|
|
131
|
+
generatedAt?: number;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Build the catalog that ends a broadcast (msf-01 §11.3): `isComplete: true` and no tracks.
|
|
135
|
+
*
|
|
136
|
+
* It commits that no track will be added and no content published, so send it only for a broadcast that ends on
|
|
137
|
+
* purpose, once every media track has ended (closing a track sends PUBLISH_DONE Track Ended), and never on a crash
|
|
138
|
+
* or lost connection.
|
|
139
|
+
*/
|
|
140
|
+
export declare function buildMsfEndCatalog(input?: MsfEndCatalogInput): Uint8Array;
|
|
141
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAGA,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,cAAc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