@blockcast/mmt-transport 2.2.0-main.aee8d33d2cc8 → 2.2.0-main.ba632bf706be

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.
@@ -475,9 +475,12 @@
475
475
  return issues;
476
476
  const tracks = Array.isArray(catalog["tracks"]) ? catalog["tracks"] : [];
477
477
  const namespaceOf = /* @__PURE__ */ new Map();
478
+ const modeOf = /* @__PURE__ */ new Map();
478
479
  for (const track of tracks) {
479
- if (isObject(track) && typeof track["name"] === "string")
480
- namespaceOf.set(track["name"], track["namespace"]);
480
+ if (!isObject(track) || typeof track["name"] !== "string")
481
+ continue;
482
+ namespaceOf.set(track["name"], track["namespace"]);
483
+ modeOf.set(track["name"], track["mmtpMode"]);
481
484
  }
482
485
  const tagged = catalog[CATALOG_NAMESPACE];
483
486
  let referenceNamespace = options.catalogNamespace ?? (typeof tagged === "string" ? tagged : void 0);
@@ -547,6 +550,9 @@
547
550
  const name = isObject(ref) ? ref["name"] : ref;
548
551
  if (typeof name !== "string")
549
552
  continue;
553
+ if (modeOf.get(name) === "mfu-datagram") {
554
+ fail("multicast_track", `${at}.tracks[${refIndex}].name`, `track ${JSON.stringify(name)} is an "mfu-datagram" track, which rides no multicast endpoint; list its "mfu" sibling (draft-ramadan-moq-mmt-02 4.3.1)`);
555
+ }
550
556
  const namespace = namespaceOf.get(name);
551
557
  if (typeof namespace !== "string")
552
558
  continue;
@@ -586,6 +592,23 @@
586
592
  const ignored = new Set(issues.map((issue) => issue.endpointIndex));
587
593
  return new Set(endpoints.map((_, index) => index).filter((index) => !ignored.has(index)));
588
594
  }
595
+ function catalogAtsc3NetworkSource(networkSource) {
596
+ const entries = Array.isArray(networkSource) ? networkSource : networkSource ? [networkSource] : [];
597
+ for (const ns of entries) {
598
+ if (!isObject(ns))
599
+ continue;
600
+ if (ns.type !== "atsc3" || !isIntegerIn(ns.frequency, 1, Number.MAX_SAFE_INTEGER))
601
+ continue;
602
+ const slsUri = typeof ns.slsUri === "string" ? ns.slsUri.trim() : "";
603
+ return {
604
+ frequency: ns.frequency,
605
+ ...isIntegerIn(ns.plpId, 0, 63) ? { plpId: ns.plpId } : {},
606
+ ...isIntegerIn(ns.serviceId, 0, 65535) ? { serviceId: ns.serviceId } : {},
607
+ ...slsUri ? { slsUri } : {}
608
+ };
609
+ }
610
+ return void 0;
611
+ }
589
612
 
590
613
  // node_modules/@blockcast/mmt-base/dist/fec-catalog.js
591
614
  var DEFAULT_SCHEMES = ["reed-solomon", "raptorq"];
@@ -1123,6 +1146,40 @@
1123
1146
  });
1124
1147
  }
1125
1148
 
1149
+ // node_modules/@blockcast/mmt-base/dist/mmtp-siblings.js
1150
+ var MMTP_MODES = Object.freeze(["mfu", "mfu-datagram"]);
1151
+ var MMTP_SIBLING_HARD_FIELDS = Object.freeze([
1152
+ "namespace",
1153
+ "timescale",
1154
+ "presentationAnchorTicks",
1155
+ "groupDuration"
1156
+ ]);
1157
+ var MMTP_SIBLING_RENDITION_FIELDS = Object.freeze([
1158
+ "codec",
1159
+ "width",
1160
+ "height",
1161
+ "framerate",
1162
+ "bitrate",
1163
+ "samplerate",
1164
+ "channelConfig",
1165
+ "lang"
1166
+ ]);
1167
+ var MMTP_SIBLING_SOFT_FIELDS = Object.freeze([
1168
+ "initRef",
1169
+ "keyframeIntervalMs",
1170
+ "keyframeIntervalTicks",
1171
+ "isLive",
1172
+ "altGroup"
1173
+ ]);
1174
+
1175
+ // node_modules/@blockcast/mmt-base/dist/datagram-leg-size.js
1176
+ var DATAGRAM_LEG_UDP_FLOOR = 1200;
1177
+ var DATAGRAM_LEG_QUIC_WT_FRAMING = 48;
1178
+ var DATAGRAM_LEG_OBJECT_HEADER = 13;
1179
+ var DATAGRAM_LEG_RELAY_ROOM = 16;
1180
+ var DATAGRAM_LEG_DATAGRAM_MAX = DATAGRAM_LEG_UDP_FLOOR - DATAGRAM_LEG_QUIC_WT_FRAMING;
1181
+ var DATAGRAM_LEG_BODY_MAX = DATAGRAM_LEG_DATAGRAM_MAX - DATAGRAM_LEG_OBJECT_HEADER - DATAGRAM_LEG_RELAY_ROOM;
1182
+
1126
1183
  // src/endpoint-config.ts
1127
1184
  function toWindowMulticastSubscribeConfig(input) {
1128
1185
  if (input.mode !== void 0 && !["auto", "native", "tunnel"].includes(input.mode)) {
@@ -1735,8 +1792,11 @@
1735
1792
  Object.assign(config, asmSenderFilter(endpoint));
1736
1793
  const ownNetworkSource = Array.isArray(endpoint.networkSource) ? endpoint.networkSource : void 0;
1737
1794
  const networkSource = ownNetworkSource ?? catalog?.multicast?.networkSource;
1738
- const amt = findAmtRelay(networkSource);
1739
- if (amt) {
1795
+ const atsc3 = config.senderAddress ? void 0 : catalogAtsc3NetworkSource(networkSource);
1796
+ const amt = atsc3 ? void 0 : findAmtRelay(networkSource);
1797
+ if (atsc3) {
1798
+ config.atsc3 = atsc3;
1799
+ } else if (amt) {
1740
1800
  config.mode = "tunnel";
1741
1801
  config.amtRelay = amt.relay;
1742
1802
  config.amtRelayPort = amt.port;
@@ -1817,8 +1877,10 @@
1817
1877
  const sameEndpoint = (endpoint) => endpoint.groupAddress === mediaEndpoint.groupAddress && (endpoint.sourceAddress || "") === (mediaEndpoint.sourceAddress || "") && Number(endpoint.port) === Number(mediaEndpoint.port);
1818
1878
  const start = endpoints.findIndex(sameEndpoint);
1819
1879
  if (start < 0) return [];
1820
- const { mode, amtRelay, amtRelayPort, amtNetworkSource } = mediaConfig;
1880
+ const { mode, amtRelay, amtRelayPort, amtNetworkSource, atsc3 } = mediaConfig;
1821
1881
  const transport = {
1882
+ // A tuned media join's repair groups ride the same RF channel.
1883
+ ...atsc3 === void 0 ? {} : { atsc3 },
1822
1884
  ...mode === void 0 ? {} : { mode },
1823
1885
  ...amtRelay === void 0 ? {} : { amtRelay },
1824
1886
  ...amtRelayPort === void 0 ? {} : { amtRelayPort },
@@ -1844,12 +1906,14 @@
1844
1906
  repairs.push({ name: track.name, packetId });
1845
1907
  }
1846
1908
  if (repairOwners.length === 0) continue;
1909
+ const sender = asmSenderFilter(endpoint);
1910
+ const { atsc3: _tuned, ...untuned } = transport;
1847
1911
  companions.push({
1848
1912
  group: endpoint.groupAddress,
1849
1913
  source: endpoint.sourceAddress || "",
1850
- ...asmSenderFilter(endpoint),
1914
+ ...sender,
1851
1915
  port: Number(endpoint.port),
1852
- ...transport,
1916
+ ...sender.senderAddress ? untuned : transport,
1853
1917
  packetIds: normalizePacketIds(repairOwners.map((owner) => owner.packetId)),
1854
1918
  repairOwners,
1855
1919
  tracks: [...owners.map((owner) => ({ ...owner })), ...repairs]
@@ -1889,6 +1953,7 @@
1889
1953
  const amtRelayPort = positivePort2(String(config.amtRelayPort ?? "")) ?? (dialableRelay ? amt?.port ?? DEFAULT_AMT_RELAY_PORT : void 0);
1890
1954
  const packetIds = normalizePacketIds(config.packetIds);
1891
1955
  const pendingAmt = dialableRelay ? [] : amtNetworkSourceEntries(config.amtNetworkSource);
1956
+ const atsc3 = config.atsc3 ? catalogAtsc3NetworkSource({ ...config.atsc3, type: "atsc3" }) : void 0;
1892
1957
  return {
1893
1958
  group: config.group,
1894
1959
  source: config.source || "",
@@ -1912,13 +1977,15 @@
1912
1977
  // whoever wires that resolution adds `amtNetworkSource` to
1913
1978
  // `sameMulticastConfig` in the same change.
1914
1979
  ...pendingAmt.length > 0 ? { amtNetworkSource: pendingAmt } : {},
1980
+ ...atsc3 ? { atsc3 } : {},
1915
1981
  ...packetIds.length > 0 ? { packetIds } : {}
1916
1982
  };
1917
1983
  }
1918
1984
  function sameMulticastConfig(a, b) {
1919
1985
  const left = normalizeMulticastConfig(a);
1920
1986
  const right = normalizeMulticastConfig(b);
1921
- return Boolean(left && right && left.group === right.group && left.source === right.source && left.port === right.port && left.mode === right.mode && left.amtRelay === right.amtRelay && (left.amtRelayPort ?? 0) === (right.amtRelayPort ?? 0) && JSON.stringify(left.packetIds ?? []) === JSON.stringify(right.packetIds ?? []));
1987
+ return Boolean(left && right && left.group === right.group && left.source === right.source && left.port === right.port && left.mode === right.mode && left.amtRelay === right.amtRelay && (left.amtRelayPort ?? 0) === (right.amtRelayPort ?? 0) && // A retune is a re-join; `slsUri` is not tuning and is ignored.
1988
+ left.atsc3?.frequency === right.atsc3?.frequency && left.atsc3?.plpId === right.atsc3?.plpId && left.atsc3?.serviceId === right.atsc3?.serviceId && JSON.stringify(left.packetIds ?? []) === JSON.stringify(right.packetIds ?? []));
1922
1989
  }
1923
1990
  function urlOverrideBlocksMulticastCandidate(candidateConfig, urlConfig = readPlayerMulticastConfig()) {
1924
1991
  if (!urlConfig) return false;