@blockcast/mmt-container 2.2.0-main.e1bebe787bc9 → 2.2.0-main.ea9223dc11de

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.
Files changed (124) hide show
  1. package/dist/block-policy.d.ts +33 -3
  2. package/dist/block-policy.d.ts.map +1 -1
  3. package/dist/block-policy.js +60 -24
  4. package/dist/block-policy.js.map +3 -3
  5. package/dist/browser-runtime.js +1034 -126
  6. package/dist/browser-runtime.js.map +4 -4
  7. package/dist/carp-catalog.d.ts +40 -1
  8. package/dist/carp-catalog.d.ts.map +1 -1
  9. package/dist/carp-catalog.js +163 -10
  10. package/dist/carp-catalog.js.map +4 -4
  11. package/dist/catalog-fec-params.js +34 -0
  12. package/dist/catalog-fec-params.js.map +3 -3
  13. package/dist/catalog-network-source.js +34 -0
  14. package/dist/catalog-network-source.js.map +3 -3
  15. package/dist/datagram-leg-deadline.d.ts +138 -0
  16. package/dist/datagram-leg-deadline.d.ts.map +1 -0
  17. package/dist/datagram-leg-deadline.js +229 -0
  18. package/dist/datagram-leg-deadline.js.map +7 -0
  19. package/dist/delivery-catalog.js +68 -0
  20. package/dist/delivery-catalog.js.map +4 -4
  21. package/dist/delta-fallback-config.js +34 -0
  22. package/dist/delta-fallback-config.js.map +3 -3
  23. package/dist/fec-manager.d.ts +117 -13
  24. package/dist/fec-manager.d.ts.map +1 -1
  25. package/dist/fec-manager.js +358 -42
  26. package/dist/fec-manager.js.map +4 -4
  27. package/dist/fec-state.d.ts +17 -5
  28. package/dist/fec-state.d.ts.map +1 -1
  29. package/dist/fec-state.js +36 -0
  30. package/dist/fec-state.js.map +3 -3
  31. package/dist/fec-worker-setup.js +34 -0
  32. package/dist/fec-worker-setup.js.map +3 -3
  33. package/dist/held-layer-admission.js +34 -0
  34. package/dist/held-layer-admission.js.map +3 -3
  35. package/dist/index.d.ts +6 -4
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +14 -0
  38. package/dist/index.js.map +2 -2
  39. package/dist/iso-block-locator.d.ts +16 -0
  40. package/dist/iso-block-locator.d.ts.map +1 -1
  41. package/dist/iso-block-locator.js +62 -0
  42. package/dist/iso-block-locator.js.map +3 -3
  43. package/dist/mfu-reassembler.js +34 -0
  44. package/dist/mfu-reassembler.js.map +3 -3
  45. package/dist/mmtp-container-parser.d.ts +6 -3
  46. package/dist/mmtp-container-parser.d.ts.map +1 -1
  47. package/dist/mmtp-container-parser.js +34 -0
  48. package/dist/mmtp-container-parser.js.map +3 -3
  49. package/dist/mmtp-container-parser.no-modules.js +167 -13
  50. package/dist/mmtp-container-parser.no-modules.js.map +4 -4
  51. package/dist/mmtp-decode-pipeline.js +34 -0
  52. package/dist/mmtp-decode-pipeline.js.map +3 -3
  53. package/dist/mmtp-fec-session.js +34 -0
  54. package/dist/mmtp-fec-session.js.map +3 -3
  55. package/dist/mmtp-mode-selection.d.ts +48 -0
  56. package/dist/mmtp-mode-selection.d.ts.map +1 -0
  57. package/dist/mmtp-mode-selection.js +79 -0
  58. package/dist/mmtp-mode-selection.js.map +7 -0
  59. package/dist/mmtp-router.d.ts +66 -10
  60. package/dist/mmtp-router.d.ts.map +1 -1
  61. package/dist/mmtp-router.js +204 -30
  62. package/dist/mmtp-router.js.map +4 -4
  63. package/dist/multicast-auth-catalog.js +42 -2
  64. package/dist/multicast-auth-catalog.js.map +3 -3
  65. package/dist/multicast-input.js +42 -2
  66. package/dist/multicast-input.js.map +3 -3
  67. package/dist/multicast-manager.d.ts +95 -1
  68. package/dist/multicast-manager.d.ts.map +1 -1
  69. package/dist/multicast-manager.js +613 -92
  70. package/dist/multicast-manager.js.map +4 -4
  71. package/dist/multicast-transport.js +68 -0
  72. package/dist/multicast-transport.js.map +4 -4
  73. package/dist/multicast-unwrap.js +34 -0
  74. package/dist/multicast-unwrap.js.map +3 -3
  75. package/dist/no-modules.js +167 -13
  76. package/dist/no-modules.js.map +4 -4
  77. package/dist/phase14-catalog-override.d.ts +2 -1
  78. package/dist/phase14-catalog-override.d.ts.map +1 -1
  79. package/dist/phase14-catalog-override.js +69 -2
  80. package/dist/phase14-catalog-override.js.map +3 -3
  81. package/dist/repair-fetch.d.ts.map +1 -1
  82. package/dist/repair-fetch.js +50 -0
  83. package/dist/repair-fetch.js.map +3 -3
  84. package/dist/repair-layer-subscriptions.js +34 -0
  85. package/dist/repair-layer-subscriptions.js.map +3 -3
  86. package/dist/signaling.js +34 -0
  87. package/dist/signaling.js.map +3 -3
  88. package/dist/timestamp-codec.js +34 -0
  89. package/dist/timestamp-codec.js.map +3 -3
  90. package/dist/wasm-mfu-reassembler.js +34 -0
  91. package/dist/wasm-mfu-reassembler.js.map +3 -3
  92. package/dist/wasm-mmtp-container-parser.js +34 -0
  93. package/dist/wasm-mmtp-container-parser.js.map +3 -3
  94. package/package.json +5 -5
  95. package/schemas/catalog.schema.json +2 -2
  96. package/src/block-policy.ts +108 -31
  97. package/src/carp-catalog.ts +165 -5
  98. package/src/datagram-leg-deadline.ts +370 -0
  99. package/src/fec-manager.ts +345 -33
  100. package/src/fec-state.ts +21 -5
  101. package/src/index.ts +37 -0
  102. package/src/iso-block-locator.ts +34 -0
  103. package/src/mmtp-container-parser.ts +6 -4
  104. package/src/mmtp-mode-selection.ts +80 -0
  105. package/src/mmtp-router.ts +226 -45
  106. package/src/multicast-manager.ts +126 -0
  107. package/src/phase14-catalog-override.ts +14 -3
  108. package/src/repair-fetch.ts +23 -0
  109. package/test-vectors/catalog/README.md +36 -2
  110. package/test-vectors/catalog/mmtp-siblings/ambiguous-sibling.json +158 -0
  111. package/test-vectors/catalog/mmtp-siblings/ladder-bitrate-only.json +231 -0
  112. package/test-vectors/catalog/mmtp-siblings/ladder-four-rungs.json +405 -0
  113. package/test-vectors/catalog/mmtp-siblings/ladder-other-names.json +231 -0
  114. package/test-vectors/catalog/mmtp-siblings/mmtp-mode-unknown.json +143 -0
  115. package/test-vectors/catalog/mmtp-siblings/multicast-endpoint-lists-datagram-track.json +143 -0
  116. package/test-vectors/catalog/mmtp-siblings/no-sibling.json +79 -0
  117. package/test-vectors/catalog/mmtp-siblings/rendition-mismatch.json +143 -0
  118. package/test-vectors/catalog/mmtp-siblings/stream-delivery-mode.json +143 -0
  119. package/test-vectors/catalog/mmtp-siblings/timescale-mismatch.json +143 -0
  120. package/test-vectors/catalog/mmtp-siblings/valid-pair.json +142 -0
  121. package/test-vectors/catalog/section-codes.json +3 -3
  122. package/test-vectors/catalog-timing.json +742 -1
  123. package/test-vectors/catalog-validation.json +266 -7
  124. package/test-vectors/moq/mmtp-mode-selection.json +259 -0
@@ -4,7 +4,9 @@
4
4
  "Hand-authored; expect null = undefined, expect 'throws' = the value cannot be derived and must fail closed.",
5
5
  "keyframeCadence, mediaUnitsPerSecond and groupDuration pin the neutral catalog rules native receiver adapters share (catalogKeyframeCadenceMs, catalogFecMediaUnitsPerSecond, catalogGroupDurationMs). They are NOT what libmmt's own receiver runs today: resolveCatalogTrackFec reads audio rate from sampleRate ?? samplerate (numeric strings admitted) with no endpoint or timescale fallback, so 'audio MP4-shaped timescale' resolves no rate there; computeBlockClassifierGeometry reads only keyframeInterval*. Converging those is a behaviour change, not part of this extraction.",
6
6
  "deliveryWindow and trackFec run against libmmt's production paths (computeFecDeliveryWindowMs, resolveCatalogTrackFec), so an adapter that drops a catalog field (fec.reorderToleranceMs, say) fails here instead of in the field. An iso-ssbg1-v1 span that is 0 or absent keeps in-band geometry but supplies no elapsed-time deadline; local receiver retention remains bounded without inventing a catalog span.",
7
- "interleaveDepth: every row names its D basis. 'access-unit' is what libmmt's receiver and the current publisher run today (D = round(span / (1000/framerate)), multicast-manager FecBlockMapper, fec-manager, block-policy); an adapter must match it to agree with them on block geometry. 'group' is draft-ramadan-moq-fec \u00a75.1/\u00a79 (D over the MoQ group duration); it is the target, not live, and moves only together with the producer contract (BLO-35597). Tick-only groupDurationTicks is authoritative for the group duration."
7
+ "interleaveDepth: every row names its D basis. 'access-unit' is what libmmt's receiver and the current publisher run today (D = round(span / (1000/framerate)), multicast-manager FecBlockMapper, fec-manager, block-policy); an adapter must match it to agree with them on block geometry. 'group' is draft-ramadan-moq-fec \u00a75.1/\u00a79 (D over the MoQ group duration); it is the target, not live, and moves only together with the producer contract (BLO-35597). Tick-only groupDurationTicks is authoritative for the group duration.",
8
+ "datagramLegDeadlines pins computeDatagramLegDeadlines: whether a player takes an \"mfu-datagram\" leg and the limits it runs on (mmt-02 4.3.1). Inputs come from the datagram entry, never from its \"mfu\" sibling. W = largest ceil(span + tolerance) of the decoded instances; take = base span > 0, G > 0, D > 0 and (W <= D or forced); joinDarkMs = ceil(G + W); darkMs = ceil(max(D, W)); noFrameMs = ceil(max(D, G + u + W)); confirmMs = base tolerance if positive, else u. An absent input field is absent, never null. No value is clamped.",
9
+ "datagramLegRetryDelay pins datagramLegRetryDelayMs: how long a player stays on the \"mfu\" sibling after a timed hand-back before it takes the \"mfu-datagram\" leg again. delay = ceil(joinDarkMs x 2^n x (1 + rand)); n = timed hand-backs in a row, rand in [0, 1) from the caller. Never below joinDarkMs: n not a finite number >= 0 counts as 0 (a fraction is floored), rand outside [0, 1) counts as 0; joinDarkMs not a finite number > 0 yields undefined (expect null). Non-finite numbers (NaN, Infinity) cannot be written in JSON and are pinned in the unit test."
8
10
  ],
9
11
  "keyframeCadence": [
10
12
  {
@@ -352,5 +354,744 @@
352
354
  "reorderToleranceMs": 0
353
355
  }
354
356
  }
357
+ ],
358
+ "datagramLegDeadlines": [
359
+ {
360
+ "name": "true spans at a 546 ms delay target",
361
+ "input": {
362
+ "fec": [
363
+ {
364
+ "interleaveDepthMs": 80,
365
+ "reorderToleranceMs": 40
366
+ }
367
+ ],
368
+ "groupDurationMs": 1000,
369
+ "mediaUnitMs": 33.333333333333336,
370
+ "delayTargetMs": 546.22
371
+ },
372
+ "expect": {
373
+ "take": true,
374
+ "reason": "ok",
375
+ "fecWindowMs": 120,
376
+ "joinDarkMs": 1120,
377
+ "darkMs": 547,
378
+ "noFrameMs": 1154,
379
+ "confirmMs": 40
380
+ }
381
+ },
382
+ {
383
+ "name": "true spans at a 500 ms delay target",
384
+ "input": {
385
+ "fec": [
386
+ {
387
+ "interleaveDepthMs": 80,
388
+ "reorderToleranceMs": 40
389
+ }
390
+ ],
391
+ "groupDurationMs": 1000,
392
+ "mediaUnitMs": 33.333333333333336,
393
+ "delayTargetMs": 500
394
+ },
395
+ "expect": {
396
+ "take": true,
397
+ "reason": "ok",
398
+ "fecWindowMs": 120,
399
+ "joinDarkMs": 1120,
400
+ "darkMs": 500,
401
+ "noFrameMs": 1154,
402
+ "confirmMs": 40
403
+ }
404
+ },
405
+ {
406
+ "name": "a 100 ms span under a 1050 ms delay target",
407
+ "input": {
408
+ "fec": [
409
+ {
410
+ "interleaveDepthMs": 100,
411
+ "reorderToleranceMs": 40
412
+ }
413
+ ],
414
+ "groupDurationMs": 1000,
415
+ "mediaUnitMs": 33.333333333333336,
416
+ "delayTargetMs": 1050
417
+ },
418
+ "expect": {
419
+ "take": true,
420
+ "reason": "ok",
421
+ "fecWindowMs": 140,
422
+ "joinDarkMs": 1140,
423
+ "darkMs": 1050,
424
+ "noFrameMs": 1174,
425
+ "confirmMs": 40
426
+ }
427
+ },
428
+ {
429
+ "name": "a deep buffer: the frame limit is the delay target",
430
+ "input": {
431
+ "fec": [
432
+ {
433
+ "interleaveDepthMs": 100,
434
+ "reorderToleranceMs": 40
435
+ }
436
+ ],
437
+ "groupDurationMs": 1000,
438
+ "mediaUnitMs": 33.333333333333336,
439
+ "delayTargetMs": 1500
440
+ },
441
+ "expect": {
442
+ "take": true,
443
+ "reason": "ok",
444
+ "fecWindowMs": 140,
445
+ "joinDarkMs": 1140,
446
+ "darkMs": 1500,
447
+ "noFrameMs": 1500,
448
+ "confirmMs": 40
449
+ }
450
+ },
451
+ {
452
+ "name": "audio: the group is one AAC frame",
453
+ "input": {
454
+ "fec": [
455
+ {
456
+ "interleaveDepthMs": 125,
457
+ "reorderToleranceMs": 40
458
+ }
459
+ ],
460
+ "groupDurationMs": 23.219954648526077,
461
+ "delayTargetMs": 546.22
462
+ },
463
+ "expect": {
464
+ "take": true,
465
+ "reason": "ok",
466
+ "fecWindowMs": 165,
467
+ "joinDarkMs": 189,
468
+ "darkMs": 547,
469
+ "noFrameMs": 547,
470
+ "confirmMs": 40
471
+ }
472
+ },
473
+ {
474
+ "name": "the window equals the delay target",
475
+ "input": {
476
+ "fec": [
477
+ {
478
+ "interleaveDepthMs": 60
479
+ }
480
+ ],
481
+ "groupDurationMs": 33.333333333333336,
482
+ "mediaUnitMs": 33.333333333333336,
483
+ "delayTargetMs": 60
484
+ },
485
+ "expect": {
486
+ "take": true,
487
+ "reason": "ok",
488
+ "fecWindowMs": 60,
489
+ "joinDarkMs": 94,
490
+ "darkMs": 60,
491
+ "noFrameMs": 127,
492
+ "confirmMs": 33.333333333333336
493
+ }
494
+ },
495
+ {
496
+ "name": "a 1000 ms span under a deep buffer",
497
+ "input": {
498
+ "fec": [
499
+ {
500
+ "interleaveDepthMs": 1000,
501
+ "reorderToleranceMs": 40
502
+ }
503
+ ],
504
+ "groupDurationMs": 1000,
505
+ "mediaUnitMs": 33.333333333333336,
506
+ "delayTargetMs": 1050
507
+ },
508
+ "expect": {
509
+ "take": true,
510
+ "reason": "ok",
511
+ "fecWindowMs": 1040,
512
+ "joinDarkMs": 2040,
513
+ "darkMs": 1050,
514
+ "noFrameMs": 2074,
515
+ "confirmMs": 40
516
+ }
517
+ },
518
+ {
519
+ "name": "the window exceeds the delay target: not taken",
520
+ "input": {
521
+ "fec": [
522
+ {
523
+ "interleaveDepthMs": 1000,
524
+ "reorderToleranceMs": 40
525
+ }
526
+ ],
527
+ "groupDurationMs": 1000,
528
+ "mediaUnitMs": 33.333333333333336,
529
+ "delayTargetMs": 500
530
+ },
531
+ "expect": {
532
+ "take": false,
533
+ "reason": "fec-window-exceeds-delay-target",
534
+ "fecWindowMs": 1040,
535
+ "joinDarkMs": 2040,
536
+ "darkMs": 1040,
537
+ "noFrameMs": 2074,
538
+ "confirmMs": 40
539
+ }
540
+ },
541
+ {
542
+ "name": "the same, forced: taken, reported, never clamped",
543
+ "input": {
544
+ "fec": [
545
+ {
546
+ "interleaveDepthMs": 1000,
547
+ "reorderToleranceMs": 40
548
+ }
549
+ ],
550
+ "groupDurationMs": 1000,
551
+ "mediaUnitMs": 33.333333333333336,
552
+ "delayTargetMs": 500,
553
+ "forced": true
554
+ },
555
+ "expect": {
556
+ "take": true,
557
+ "reason": "fec-window-exceeds-delay-target",
558
+ "fecWindowMs": 1040,
559
+ "joinDarkMs": 2040,
560
+ "darkMs": 1040,
561
+ "noFrameMs": 2074,
562
+ "confirmMs": 40
563
+ }
564
+ },
565
+ {
566
+ "name": "a 4000 ms span, forced",
567
+ "input": {
568
+ "fec": [
569
+ {
570
+ "interleaveDepthMs": 4000,
571
+ "reorderToleranceMs": 40
572
+ }
573
+ ],
574
+ "groupDurationMs": 1000,
575
+ "mediaUnitMs": 33.333333333333336,
576
+ "delayTargetMs": 500,
577
+ "forced": true
578
+ },
579
+ "expect": {
580
+ "take": true,
581
+ "reason": "fec-window-exceeds-delay-target",
582
+ "fecWindowMs": 4040,
583
+ "joinDarkMs": 5040,
584
+ "darkMs": 4040,
585
+ "noFrameMs": 5074,
586
+ "confirmMs": 40
587
+ }
588
+ },
589
+ {
590
+ "name": "a 50 ms delay target takes no leg",
591
+ "input": {
592
+ "fec": [
593
+ {
594
+ "interleaveDepthMs": 80,
595
+ "reorderToleranceMs": 40
596
+ }
597
+ ],
598
+ "groupDurationMs": 1000,
599
+ "mediaUnitMs": 33.333333333333336,
600
+ "delayTargetMs": 50
601
+ },
602
+ "expect": {
603
+ "take": false,
604
+ "reason": "fec-window-exceeds-delay-target",
605
+ "fecWindowMs": 120,
606
+ "joinDarkMs": 1120,
607
+ "darkMs": 120,
608
+ "noFrameMs": 1154,
609
+ "confirmMs": 40
610
+ }
611
+ },
612
+ {
613
+ "name": "absent tolerance stays absent",
614
+ "input": {
615
+ "fec": [
616
+ {
617
+ "interleaveDepthMs": 100.2
618
+ }
619
+ ],
620
+ "groupDurationMs": 1000,
621
+ "mediaUnitMs": 33.333333333333336,
622
+ "delayTargetMs": 500
623
+ },
624
+ "expect": {
625
+ "take": true,
626
+ "reason": "ok",
627
+ "fecWindowMs": 101,
628
+ "joinDarkMs": 1101,
629
+ "darkMs": 500,
630
+ "noFrameMs": 1135,
631
+ "confirmMs": 33.333333333333336
632
+ }
633
+ },
634
+ {
635
+ "name": "a declared 0 tolerance adds nothing",
636
+ "input": {
637
+ "fec": [
638
+ {
639
+ "interleaveDepthMs": 100,
640
+ "reorderToleranceMs": 0
641
+ }
642
+ ],
643
+ "groupDurationMs": 1000,
644
+ "mediaUnitMs": 33.333333333333336,
645
+ "delayTargetMs": 500
646
+ },
647
+ "expect": {
648
+ "take": true,
649
+ "reason": "ok",
650
+ "fecWindowMs": 100,
651
+ "joinDarkMs": 1100,
652
+ "darkMs": 500,
653
+ "noFrameMs": 1134,
654
+ "confirmMs": 33.333333333333336
655
+ }
656
+ },
657
+ {
658
+ "name": "no media unit stated",
659
+ "input": {
660
+ "fec": [
661
+ {
662
+ "interleaveDepthMs": 80,
663
+ "reorderToleranceMs": 40
664
+ }
665
+ ],
666
+ "groupDurationMs": 1000,
667
+ "delayTargetMs": 500
668
+ },
669
+ "expect": {
670
+ "take": true,
671
+ "reason": "ok",
672
+ "fecWindowMs": 120,
673
+ "joinDarkMs": 1120,
674
+ "darkMs": 500,
675
+ "noFrameMs": 1120,
676
+ "confirmMs": 40
677
+ }
678
+ },
679
+ {
680
+ "name": "neither tolerance nor media unit: the confirming turn has no delay",
681
+ "input": {
682
+ "fec": [
683
+ {
684
+ "interleaveDepthMs": 100
685
+ }
686
+ ],
687
+ "groupDurationMs": 1000,
688
+ "delayTargetMs": 500
689
+ },
690
+ "expect": {
691
+ "take": true,
692
+ "reason": "ok",
693
+ "fecWindowMs": 100,
694
+ "joinDarkMs": 1100,
695
+ "darkMs": 500,
696
+ "noFrameMs": 1100,
697
+ "confirmMs": 0
698
+ }
699
+ },
700
+ {
701
+ "name": "a decoded overlay bounds the leg",
702
+ "input": {
703
+ "fec": [
704
+ {
705
+ "interleaveDepthMs": 80,
706
+ "reorderToleranceMs": 40
707
+ },
708
+ {
709
+ "interleaveDepthMs": 250,
710
+ "reorderToleranceMs": 40
711
+ }
712
+ ],
713
+ "groupDurationMs": 1000,
714
+ "mediaUnitMs": 33.333333333333336,
715
+ "delayTargetMs": 546.22
716
+ },
717
+ "expect": {
718
+ "take": true,
719
+ "reason": "ok",
720
+ "fecWindowMs": 290,
721
+ "joinDarkMs": 1290,
722
+ "darkMs": 547,
723
+ "noFrameMs": 1324,
724
+ "confirmMs": 40
725
+ }
726
+ },
727
+ {
728
+ "name": "an overlay with no span adds no window",
729
+ "input": {
730
+ "fec": [
731
+ {
732
+ "interleaveDepthMs": 80,
733
+ "reorderToleranceMs": 40
734
+ },
735
+ {
736
+ "reorderToleranceMs": 40
737
+ }
738
+ ],
739
+ "groupDurationMs": 1000,
740
+ "mediaUnitMs": 33.333333333333336,
741
+ "delayTargetMs": 546.22
742
+ },
743
+ "expect": {
744
+ "take": true,
745
+ "reason": "ok",
746
+ "fecWindowMs": 120,
747
+ "joinDarkMs": 1120,
748
+ "darkMs": 547,
749
+ "noFrameMs": 1154,
750
+ "confirmMs": 40
751
+ }
752
+ },
753
+ {
754
+ "name": "zero span",
755
+ "input": {
756
+ "fec": [
757
+ {
758
+ "interleaveDepthMs": 0,
759
+ "reorderToleranceMs": 40
760
+ }
761
+ ],
762
+ "groupDurationMs": 1000,
763
+ "mediaUnitMs": 33.333333333333336,
764
+ "delayTargetMs": 500
765
+ },
766
+ "expect": {
767
+ "take": false,
768
+ "reason": "no-fec-span"
769
+ }
770
+ },
771
+ {
772
+ "name": "absent span",
773
+ "input": {
774
+ "fec": [
775
+ {
776
+ "reorderToleranceMs": 40
777
+ }
778
+ ],
779
+ "groupDurationMs": 1000,
780
+ "mediaUnitMs": 33.333333333333336,
781
+ "delayTargetMs": 500
782
+ },
783
+ "expect": {
784
+ "take": false,
785
+ "reason": "no-fec-span"
786
+ }
787
+ },
788
+ {
789
+ "name": "no instance",
790
+ "input": {
791
+ "fec": [],
792
+ "groupDurationMs": 1000,
793
+ "mediaUnitMs": 33.333333333333336,
794
+ "delayTargetMs": 500
795
+ },
796
+ "expect": {
797
+ "take": false,
798
+ "reason": "no-fec-span"
799
+ }
800
+ },
801
+ {
802
+ "name": "negative tolerance",
803
+ "input": {
804
+ "fec": [
805
+ {
806
+ "interleaveDepthMs": 80,
807
+ "reorderToleranceMs": -1
808
+ }
809
+ ],
810
+ "groupDurationMs": 1000,
811
+ "mediaUnitMs": 33.333333333333336,
812
+ "delayTargetMs": 500
813
+ },
814
+ "expect": {
815
+ "take": false,
816
+ "reason": "no-fec-span"
817
+ }
818
+ },
819
+ {
820
+ "name": "an overlay with a span and a base without",
821
+ "input": {
822
+ "fec": [
823
+ {
824
+ "reorderToleranceMs": 40
825
+ },
826
+ {
827
+ "interleaveDepthMs": 250,
828
+ "reorderToleranceMs": 40
829
+ }
830
+ ],
831
+ "groupDurationMs": 1000,
832
+ "mediaUnitMs": 33.333333333333336,
833
+ "delayTargetMs": 500
834
+ },
835
+ "expect": {
836
+ "take": false,
837
+ "reason": "no-fec-span"
838
+ }
839
+ },
840
+ {
841
+ "name": "the forced mode does not run a leg with no span",
842
+ "input": {
843
+ "fec": [
844
+ {
845
+ "interleaveDepthMs": 0,
846
+ "reorderToleranceMs": 40
847
+ }
848
+ ],
849
+ "groupDurationMs": 1000,
850
+ "mediaUnitMs": 33.333333333333336,
851
+ "delayTargetMs": 500,
852
+ "forced": true
853
+ },
854
+ "expect": {
855
+ "take": false,
856
+ "reason": "no-fec-span"
857
+ }
858
+ },
859
+ {
860
+ "name": "no group duration",
861
+ "input": {
862
+ "fec": [
863
+ {
864
+ "interleaveDepthMs": 80,
865
+ "reorderToleranceMs": 40
866
+ }
867
+ ],
868
+ "mediaUnitMs": 33.333333333333336,
869
+ "delayTargetMs": 500
870
+ },
871
+ "expect": {
872
+ "take": false,
873
+ "reason": "no-group-duration",
874
+ "fecWindowMs": 120
875
+ }
876
+ },
877
+ {
878
+ "name": "no delay target",
879
+ "input": {
880
+ "fec": [
881
+ {
882
+ "interleaveDepthMs": 80,
883
+ "reorderToleranceMs": 40
884
+ }
885
+ ],
886
+ "groupDurationMs": 1000,
887
+ "mediaUnitMs": 33.333333333333336
888
+ },
889
+ "expect": {
890
+ "take": false,
891
+ "reason": "no-delay-target",
892
+ "fecWindowMs": 120
893
+ }
894
+ },
895
+ {
896
+ "name": "a zero delay target",
897
+ "input": {
898
+ "fec": [
899
+ {
900
+ "interleaveDepthMs": 80,
901
+ "reorderToleranceMs": 40
902
+ }
903
+ ],
904
+ "groupDurationMs": 1000,
905
+ "mediaUnitMs": 33.333333333333336,
906
+ "delayTargetMs": 0
907
+ },
908
+ "expect": {
909
+ "take": false,
910
+ "reason": "no-delay-target",
911
+ "fecWindowMs": 120
912
+ }
913
+ }
914
+ ],
915
+ "datagramLegRetryDelay": [
916
+ {
917
+ "name": "first hand-back, no jitter: joinDarkMs (plan (b))",
918
+ "input": {
919
+ "joinDarkMs": 1120,
920
+ "n": 0,
921
+ "rand": 0
922
+ },
923
+ "expect": 1120
924
+ },
925
+ {
926
+ "name": "first hand-back, jitter near 1: just under 2 x joinDarkMs",
927
+ "input": {
928
+ "joinDarkMs": 1120,
929
+ "n": 0,
930
+ "rand": 0.999
931
+ },
932
+ "expect": 2239
933
+ },
934
+ {
935
+ "name": "first hand-back, half jitter",
936
+ "input": {
937
+ "joinDarkMs": 1120,
938
+ "n": 0,
939
+ "rand": 0.5
940
+ },
941
+ "expect": 1680
942
+ },
943
+ {
944
+ "name": "second hand-back in a row: 2.24 s",
945
+ "input": {
946
+ "joinDarkMs": 1120,
947
+ "n": 1,
948
+ "rand": 0
949
+ },
950
+ "expect": 2240
951
+ },
952
+ {
953
+ "name": "second hand-back, half jitter",
954
+ "input": {
955
+ "joinDarkMs": 1120,
956
+ "n": 1,
957
+ "rand": 0.5
958
+ },
959
+ "expect": 3360
960
+ },
961
+ {
962
+ "name": "third hand-back in a row: 4.48 s",
963
+ "input": {
964
+ "joinDarkMs": 1120,
965
+ "n": 2,
966
+ "rand": 0
967
+ },
968
+ "expect": 4480
969
+ },
970
+ {
971
+ "name": "third hand-back, jitter near 1: just under 8.96 s",
972
+ "input": {
973
+ "joinDarkMs": 1120,
974
+ "n": 2,
975
+ "rand": 0.999
976
+ },
977
+ "expect": 8956
978
+ },
979
+ {
980
+ "name": "a fractional product rounds up to a whole ms",
981
+ "input": {
982
+ "joinDarkMs": 1120,
983
+ "n": 0,
984
+ "rand": 0.0001
985
+ },
986
+ "expect": 1121
987
+ },
988
+ {
989
+ "name": "negative n counts as 0",
990
+ "input": {
991
+ "joinDarkMs": 1120,
992
+ "n": -1,
993
+ "rand": 0
994
+ },
995
+ "expect": 1120
996
+ },
997
+ {
998
+ "name": "fractional n is floored",
999
+ "input": {
1000
+ "joinDarkMs": 1120,
1001
+ "n": 1.9,
1002
+ "rand": 0
1003
+ },
1004
+ "expect": 2240
1005
+ },
1006
+ {
1007
+ "name": "n not a number counts as 0",
1008
+ "input": {
1009
+ "joinDarkMs": 1120,
1010
+ "n": "2",
1011
+ "rand": 0.5
1012
+ },
1013
+ "expect": 1680
1014
+ },
1015
+ {
1016
+ "name": "n null counts as 0",
1017
+ "input": {
1018
+ "joinDarkMs": 1120,
1019
+ "n": null,
1020
+ "rand": 0
1021
+ },
1022
+ "expect": 1120
1023
+ },
1024
+ {
1025
+ "name": "rand 1 is outside [0, 1): counts as 0",
1026
+ "input": {
1027
+ "joinDarkMs": 1120,
1028
+ "n": 1,
1029
+ "rand": 1
1030
+ },
1031
+ "expect": 2240
1032
+ },
1033
+ {
1034
+ "name": "negative rand counts as 0",
1035
+ "input": {
1036
+ "joinDarkMs": 1120,
1037
+ "n": 0,
1038
+ "rand": -0.5
1039
+ },
1040
+ "expect": 1120
1041
+ },
1042
+ {
1043
+ "name": "rand above 1 counts as 0",
1044
+ "input": {
1045
+ "joinDarkMs": 1120,
1046
+ "n": 0,
1047
+ "rand": 3
1048
+ },
1049
+ "expect": 1120
1050
+ },
1051
+ {
1052
+ "name": "rand not a number counts as 0",
1053
+ "input": {
1054
+ "joinDarkMs": 1120,
1055
+ "n": 0,
1056
+ "rand": "0.5"
1057
+ },
1058
+ "expect": 1120
1059
+ },
1060
+ {
1061
+ "name": "joinDarkMs 0: no leg, undefined",
1062
+ "input": {
1063
+ "joinDarkMs": 0,
1064
+ "n": 0,
1065
+ "rand": 0
1066
+ },
1067
+ "expect": null
1068
+ },
1069
+ {
1070
+ "name": "negative joinDarkMs: undefined",
1071
+ "input": {
1072
+ "joinDarkMs": -1120,
1073
+ "n": 0,
1074
+ "rand": 0
1075
+ },
1076
+ "expect": null
1077
+ },
1078
+ {
1079
+ "name": "joinDarkMs not a number: undefined",
1080
+ "input": {
1081
+ "joinDarkMs": "1120",
1082
+ "n": 0,
1083
+ "rand": 0
1084
+ },
1085
+ "expect": null
1086
+ },
1087
+ {
1088
+ "name": "joinDarkMs null: undefined",
1089
+ "input": {
1090
+ "joinDarkMs": null,
1091
+ "n": 0,
1092
+ "rand": 0
1093
+ },
1094
+ "expect": null
1095
+ }
355
1096
  ]
356
1097
  }