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
29 changes: 28 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
// indexes. Exclude two kinds it can't handle:
// - MPEG transport-stream fixtures whose `.ts` extension collides with TypeScript.
// - SVG assets, which Biome routes to its HTML parser and rejects.
"includes": ["**", "!rs/moq-mux/src/container/ts/test_data", "!**/*.svg"]
// - The audio jitter corpus, which is generated and byte-compared by its own test,
// so a formatter rewriting it would fight the generator on every `just fix`.
"includes": ["**", "!rs/moq-mux/src/container/ts/test_data", "!**/*.svg", "!doc/concept/audio-jitter/*.json"]
},
"linter": {
"rules": {
Expand Down Expand Up @@ -59,6 +61,31 @@
}
},
"overrides": [
{
// The audio jitter reference is the corpus generator, not a library: an
// implementation that calls it proves nothing about the normative document.
"includes": ["**", "!doc/concept/audio-jitter/**"],
"linter": {
"rules": {
"style": {
"noRestrictedImports": {
"level": "error",
"options": {
"patterns": [
{
"group": [
"**/concept/audio-jitter/reference",
"**/concept/audio-jitter/reference.*"
],
"message": "doc/concept/audio-jitter/reference.ts is non-normative. Implement the document, don't import the reference."
}
]
}
}
}
}
}
},
{
"includes": ["doc/.vitepress/theme/custom.css"],
"linter": {
Expand Down
1 change: 1 addition & 0 deletions doc/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default defineConfig({
{ text: "Transport", link: "/concept/transport" },
{ text: "moq-lite", link: "/concept/moq-lite" },
{ text: "hang", link: "/concept/hang" },
{ text: "Audio jitter", link: "/concept/audio-jitter" },
{ text: "Standards", link: "/concept/standard" },
{
text: "Use cases",
Expand Down
444 changes: 444 additions & 0 deletions doc/concept/audio-jitter.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/concept/audio-jitter/advertised.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"advertised","about":"The same even sender as `paced`, with a publisher advertising a 200 ms flush span. The advertised value is a floor on the measured term, not an addition to it, so the target holds there instead of converging down.","frame":20,"advertised":200,"arrival":[50,70,90,110,130,150,170,190,210,230,250,270,290,310,330,350,370,390,410,430,450,470,490,510,530,550,570,590,610,630,650,670,690,710,730,750,770,790,810,830,850,870,890,910,930,950,970,990,1010,1030,1050,1070,1090,1110,1130,1150,1170,1190,1210,1230,1250,1270,1290,1310,1330,1350,1370,1390,1410,1430,1450,1470,1490,1510,1530,1550,1570,1590,1610,1630,1650,1670,1690,1710,1730,1750,1770,1790,1810,1830,1850,1870,1890,1910,1930,1950,1970,1990,2010,2030,2050,2070,2090,2110,2130,2150,2170,2190,2210,2230,2250,2270,2290,2310,2330,2350,2370,2390,2410,2430,2450,2470,2490,2510,2530,2550,2570,2590,2610,2630,2650,2670,2690,2710,2730,2750,2770,2790,2810,2830,2850,2870,2890,2910,2930,2950,2970,2990,3010,3030,3050,3070,3090,3110,3130,3150,3170,3190,3210,3230,3250,3270,3290,3310,3330,3350,3370,3390,3410,3430,3450,3470,3490,3510,3530,3550,3570,3590,3610,3630,3650,3670,3690,3710,3730,3750,3770,3790,3810,3830,3850,3870,3890,3910,3930,3950,3970,3990,4010,4030,4050,4070,4090,4110,4130,4150,4170,4190,4210,4230,4250,4270,4290,4310,4330,4350,4370,4390,4410,4430,4450,4470,4490,4510,4530,4550,4570,4590,4610,4630,4650,4670,4690,4710,4730,4750,4770,4790,4810,4830,4850,4870,4890,4910,4930,4950,4970,4990,5010,5030,5050,5070,5090,5110,5130,5150,5170,5190,5210,5230,5250,5270,5290,5310,5330,5350,5370,5390,5410,5430,5450,5470,5490,5510,5530,5550,5570,5590,5610,5630,5650,5670,5690,5710,5730,5750,5770,5790,5810,5830,5850,5870,5890,5910,5930,5950,5970,5990,6010,6030,6050,6070,6090,6110,6130,6150,6170,6190,6210,6230,6250,6270,6290,6310,6330,6350,6370,6390,6410,6430,6450,6470,6490,6510,6530,6550,6570,6590,6610,6630,6650,6670,6690,6710,6730,6750,6770,6790,6810,6830,6850,6870,6890,6910,6930,6950,6970,6990,7010,7030,7050,7070,7090,7110,7130,7150,7170,7190,7210,7230,7250,7270,7290,7310,7330,7350,7370,7390,7410,7430,7450,7470,7490,7510,7530,7550,7570,7590,7610,7630,7650,7670,7690,7710,7730,7750,7770,7790,7810,7830,7850,7870,7890,7910,7930,7950,7970,7990,8010,8030,8050,8070,8090,8110,8130,8150,8170,8190,8210,8230,8250,8270,8290,8310,8330,8350,8370,8390,8410,8430,8450,8470,8490,8510,8530,8550,8570,8590,8610,8630,8650,8670,8690,8710,8730,8750,8770,8790,8810,8830,8850,8870,8890,8910,8930,8950,8970,8990,9010,9030,9050,9070,9090,9110,9130,9150,9170,9190,9210,9230,9250,9270,9290,9310,9330,9350,9370,9390,9410,9430,9450,9470,9490,9510,9530,9550,9570,9590,9610,9630,9650,9670,9690,9710,9730,9750,9770,9790,9810,9830,9850,9870,9890,9910,9930,9950,9970,9990,10010,10030,10050,10070,10090,10110,10130,10150,10170,10190,10210,10230,10250,10270,10290,10310,10330,10350,10370,10390,10410,10430,10450,10470,10490,10510,10530,10550,10570,10590,10610,10630,10650,10670,10690,10710,10730,10750,10770,10790,10810,10830,10850,10870,10890,10910,10930,10950,10970,10990,11010,11030,11050,11070,11090,11110,11130,11150,11170,11190,11210,11230,11250,11270,11290,11310,11330,11350,11370,11390,11410,11430,11450,11470,11490,11510,11530,11550,11570,11590,11610,11630,11650,11670,11690,11710,11730,11750,11770,11790,11810,11830,11850,11870,11890,11910,11930,11950,11970,11990,12010,12030,12050,12070,12090,12110,12130,12150,12170,12190,12210,12230,12250,12270,12290,12310,12330,12350,12370,12390,12410,12430,12450,12470,12490,12510,12530,12550,12570,12590,12610,12630,12650,12670,12690,12710,12730,12750,12770,12790,12810,12830,12850,12870,12890,12910,12930,12950,12970,12990,13010,13030,13050,13070,13090,13110,13130,13150,13170,13190,13210,13230,13250,13270,13290,13310,13330,13350,13370,13390,13410,13430,13450,13470,13490,13510,13530,13550,13570,13590,13610,13630,13650,13670,13690,13710,13730,13750,13770,13790,13810,13830,13850,13870,13890,13910,13930,13950,13970,13990,14010,14030,14050,14070,14090,14110,14130,14150,14170,14190,14210,14230,14250,14270,14290,14310,14330,14350,14370,14390,14410,14430,14450,14470,14490,14510,14530,14550,14570,14590,14610,14630,14650,14670,14690,14710,14730,14750,14770,14790,14810,14830,14850,14870,14890,14910,14930,14950,14970,14990,15010,15030,15050,15070,15090,15110,15130,15150,15170,15190,15210,15230,15250,15270,15290,15310,15330,15350,15370,15390,15410,15430,15450,15470,15490,15510,15530,15550,15570,15590,15610,15630,15650,15670,15690,15710,15730,15750,15770,15790,15810,15830,15850,15870,15890,15910,15930,15950,15970,15990,16010,16030,16050,16070,16090,16110,16130,16150,16170,16190,16210,16230,16250,16270,16290,16310,16330,16350,16370,16390,16410,16430,16450,16470,16490,16510,16530,16550,16570,16590,16610,16630,16650,16670,16690,16710,16730,16750,16770,16790,16810,16830,16850,16870,16890,16910,16930,16950,16970,16990,17010,17030,17050,17070,17090,17110,17130,17150,17170,17190,17210,17230,17250,17270,17290,17310,17330,17350,17370,17390,17410,17430,17450,17470,17490,17510,17530,17550,17570,17590,17610,17630,17650,17670,17690,17710,17730,17750,17770,17790,17810,17830,17850,17870,17890,17910,17930,17950,17970,17990,18010,18030,18050,18070,18090,18110,18130,18150,18170,18190,18210,18230,18250,18270,18290,18310,18330,18350,18370,18390,18410,18430,18450,18470,18490,18510,18530,18550,18570,18590,18610,18630,18650,18670,18690,18710,18730,18750,18770,18790,18810,18830,18850,18870,18890,18910,18930,18950,18970,18990,19010,19030,19050,19070,19090,19110,19130,19150,19170,19190,19210,19230,19250,19270,19290,19310,19330,19350,19370,19390,19410,19430,19450,19470,19490,19510,19530,19550,19570,19590,19610,19630,19650,19670,19690,19710,19730,19750,19770,19790,19810,19830,19850,19870,19890,19910,19930,19950,19970,19990,20010,20030],"media":[0,20,40,60,80,100,120,140,160,180,200,220,240,260,280,300,320,340,360,380,400,420,440,460,480,500,520,540,560,580,600,620,640,660,680,700,720,740,760,780,800,820,840,860,880,900,920,940,960,980,1000,1020,1040,1060,1080,1100,1120,1140,1160,1180,1200,1220,1240,1260,1280,1300,1320,1340,1360,1380,1400,1420,1440,1460,1480,1500,1520,1540,1560,1580,1600,1620,1640,1660,1680,1700,1720,1740,1760,1780,1800,1820,1840,1860,1880,1900,1920,1940,1960,1980,2000,2020,2040,2060,2080,2100,2120,2140,2160,2180,2200,2220,2240,2260,2280,2300,2320,2340,2360,2380,2400,2420,2440,2460,2480,2500,2520,2540,2560,2580,2600,2620,2640,2660,2680,2700,2720,2740,2760,2780,2800,2820,2840,2860,2880,2900,2920,2940,2960,2980,3000,3020,3040,3060,3080,3100,3120,3140,3160,3180,3200,3220,3240,3260,3280,3300,3320,3340,3360,3380,3400,3420,3440,3460,3480,3500,3520,3540,3560,3580,3600,3620,3640,3660,3680,3700,3720,3740,3760,3780,3800,3820,3840,3860,3880,3900,3920,3940,3960,3980,4000,4020,4040,4060,4080,4100,4120,4140,4160,4180,4200,4220,4240,4260,4280,4300,4320,4340,4360,4380,4400,4420,4440,4460,4480,4500,4520,4540,4560,4580,4600,4620,4640,4660,4680,4700,4720,4740,4760,4780,4800,4820,4840,4860,4880,4900,4920,4940,4960,4980,5000,5020,5040,5060,5080,5100,5120,5140,5160,5180,5200,5220,5240,5260,5280,5300,5320,5340,5360,5380,5400,5420,5440,5460,5480,5500,5520,5540,5560,5580,5600,5620,5640,5660,5680,5700,5720,5740,5760,5780,5800,5820,5840,5860,5880,5900,5920,5940,5960,5980,6000,6020,6040,6060,6080,6100,6120,6140,6160,6180,6200,6220,6240,6260,6280,6300,6320,6340,6360,6380,6400,6420,6440,6460,6480,6500,6520,6540,6560,6580,6600,6620,6640,6660,6680,6700,6720,6740,6760,6780,6800,6820,6840,6860,6880,6900,6920,6940,6960,6980,7000,7020,7040,7060,7080,7100,7120,7140,7160,7180,7200,7220,7240,7260,7280,7300,7320,7340,7360,7380,7400,7420,7440,7460,7480,7500,7520,7540,7560,7580,7600,7620,7640,7660,7680,7700,7720,7740,7760,7780,7800,7820,7840,7860,7880,7900,7920,7940,7960,7980,8000,8020,8040,8060,8080,8100,8120,8140,8160,8180,8200,8220,8240,8260,8280,8300,8320,8340,8360,8380,8400,8420,8440,8460,8480,8500,8520,8540,8560,8580,8600,8620,8640,8660,8680,8700,8720,8740,8760,8780,8800,8820,8840,8860,8880,8900,8920,8940,8960,8980,9000,9020,9040,9060,9080,9100,9120,9140,9160,9180,9200,9220,9240,9260,9280,9300,9320,9340,9360,9380,9400,9420,9440,9460,9480,9500,9520,9540,9560,9580,9600,9620,9640,9660,9680,9700,9720,9740,9760,9780,9800,9820,9840,9860,9880,9900,9920,9940,9960,9980,10000,10020,10040,10060,10080,10100,10120,10140,10160,10180,10200,10220,10240,10260,10280,10300,10320,10340,10360,10380,10400,10420,10440,10460,10480,10500,10520,10540,10560,10580,10600,10620,10640,10660,10680,10700,10720,10740,10760,10780,10800,10820,10840,10860,10880,10900,10920,10940,10960,10980,11000,11020,11040,11060,11080,11100,11120,11140,11160,11180,11200,11220,11240,11260,11280,11300,11320,11340,11360,11380,11400,11420,11440,11460,11480,11500,11520,11540,11560,11580,11600,11620,11640,11660,11680,11700,11720,11740,11760,11780,11800,11820,11840,11860,11880,11900,11920,11940,11960,11980,12000,12020,12040,12060,12080,12100,12120,12140,12160,12180,12200,12220,12240,12260,12280,12300,12320,12340,12360,12380,12400,12420,12440,12460,12480,12500,12520,12540,12560,12580,12600,12620,12640,12660,12680,12700,12720,12740,12760,12780,12800,12820,12840,12860,12880,12900,12920,12940,12960,12980,13000,13020,13040,13060,13080,13100,13120,13140,13160,13180,13200,13220,13240,13260,13280,13300,13320,13340,13360,13380,13400,13420,13440,13460,13480,13500,13520,13540,13560,13580,13600,13620,13640,13660,13680,13700,13720,13740,13760,13780,13800,13820,13840,13860,13880,13900,13920,13940,13960,13980,14000,14020,14040,14060,14080,14100,14120,14140,14160,14180,14200,14220,14240,14260,14280,14300,14320,14340,14360,14380,14400,14420,14440,14460,14480,14500,14520,14540,14560,14580,14600,14620,14640,14660,14680,14700,14720,14740,14760,14780,14800,14820,14840,14860,14880,14900,14920,14940,14960,14980,15000,15020,15040,15060,15080,15100,15120,15140,15160,15180,15200,15220,15240,15260,15280,15300,15320,15340,15360,15380,15400,15420,15440,15460,15480,15500,15520,15540,15560,15580,15600,15620,15640,15660,15680,15700,15720,15740,15760,15780,15800,15820,15840,15860,15880,15900,15920,15940,15960,15980,16000,16020,16040,16060,16080,16100,16120,16140,16160,16180,16200,16220,16240,16260,16280,16300,16320,16340,16360,16380,16400,16420,16440,16460,16480,16500,16520,16540,16560,16580,16600,16620,16640,16660,16680,16700,16720,16740,16760,16780,16800,16820,16840,16860,16880,16900,16920,16940,16960,16980,17000,17020,17040,17060,17080,17100,17120,17140,17160,17180,17200,17220,17240,17260,17280,17300,17320,17340,17360,17380,17400,17420,17440,17460,17480,17500,17520,17540,17560,17580,17600,17620,17640,17660,17680,17700,17720,17740,17760,17780,17800,17820,17840,17860,17880,17900,17920,17940,17960,17980,18000,18020,18040,18060,18080,18100,18120,18140,18160,18180,18200,18220,18240,18260,18280,18300,18320,18340,18360,18380,18400,18420,18440,18460,18480,18500,18520,18540,18560,18580,18600,18620,18640,18660,18680,18700,18720,18740,18760,18780,18800,18820,18840,18860,18880,18900,18920,18940,18960,18980,19000,19020,19040,19060,19080,19100,19120,19140,19160,19180,19200,19220,19240,19260,19280,19300,19320,19340,19360,19380,19400,19420,19440,19460,19480,19500,19520,19540,19560,19580,19600,19620,19640,19660,19680,19700,19720,19740,19760,19780,19800,19820,19840,19860,19880,19900,19920,19940,19960,19980],"target":[[0,220]]}
1 change: 1 addition & 0 deletions doc/concept/audio-jitter/buildup.json

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions doc/concept/audio-jitter/corpus.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// The corpus is data the two implementations are graded against, so the one thing this
// has to catch is the corpus drifting from the algorithm it claims to encode: a checked-in
// file edited by hand to make a failing implementation pass would otherwise go unnoticed.
//
// Grading an implementation is each language's own test suite, since neither exists yet.

import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { type Case, cases } from "./corpus";

const here = dirname(fileURLToPath(import.meta.url));

describe("audio jitter corpus", () => {
for (const expected of cases) {
describe(expected.name, () => {
const actual = JSON.parse(readFileSync(join(here, `${expected.name}.json`), "utf8")) as Case;

test("matches the checked-in file", () => {
expect(actual).toEqual(expected);
});

test("is a trace of equal-length clocks", () => {
expect(actual.arrival.length).toBe(actual.media.length);
expect(actual.arrival.length).toBeGreaterThan(0);
});

test("arrives in a monotonic order", () => {
for (let i = 1; i < actual.arrival.length; i++) {
expect(actual.arrival[i]).toBeGreaterThanOrEqual(actual.arrival[i - 1]);
}
});

test("names a target for the first frame", () => {
expect(actual.target[0]?.[0]).toBe(0);
});

test("reports every target as a change", () => {
let previous: number | undefined;
let last = -1;
for (const [index, value] of actual.target) {
expect(index).toBeGreaterThan(last);
expect(index).toBeLessThan(actual.arrival.length);
expect(value).not.toBe(previous);
previous = value;
last = index;
}
});
});
}
});
Loading
Loading