@blockcast/mmt-transport 2.2.0-main.5da4e39e7fb8 → 2.2.0-main.5e3e277b4606

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.
@@ -592,6 +592,23 @@
592
592
  const ignored = new Set(issues.map((issue) => issue.endpointIndex));
593
593
  return new Set(endpoints.map((_, index) => index).filter((index) => !ignored.has(index)));
594
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
+ }
595
612
 
596
613
  // node_modules/@blockcast/mmt-base/dist/fec-catalog.js
597
614
  var DEFAULT_SCHEMES = ["reed-solomon", "raptorq"];
@@ -1775,8 +1792,11 @@
1775
1792
  Object.assign(config, asmSenderFilter(endpoint));
1776
1793
  const ownNetworkSource = Array.isArray(endpoint.networkSource) ? endpoint.networkSource : void 0;
1777
1794
  const networkSource = ownNetworkSource ?? catalog?.multicast?.networkSource;
1778
- const amt = findAmtRelay(networkSource);
1779
- 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) {
1780
1800
  config.mode = "tunnel";
1781
1801
  config.amtRelay = amt.relay;
1782
1802
  config.amtRelayPort = amt.port;
@@ -1857,8 +1877,10 @@
1857
1877
  const sameEndpoint = (endpoint) => endpoint.groupAddress === mediaEndpoint.groupAddress && (endpoint.sourceAddress || "") === (mediaEndpoint.sourceAddress || "") && Number(endpoint.port) === Number(mediaEndpoint.port);
1858
1878
  const start = endpoints.findIndex(sameEndpoint);
1859
1879
  if (start < 0) return [];
1860
- const { mode, amtRelay, amtRelayPort, amtNetworkSource } = mediaConfig;
1880
+ const { mode, amtRelay, amtRelayPort, amtNetworkSource, atsc3 } = mediaConfig;
1861
1881
  const transport = {
1882
+ // A tuned media join's repair groups ride the same RF channel.
1883
+ ...atsc3 === void 0 ? {} : { atsc3 },
1862
1884
  ...mode === void 0 ? {} : { mode },
1863
1885
  ...amtRelay === void 0 ? {} : { amtRelay },
1864
1886
  ...amtRelayPort === void 0 ? {} : { amtRelayPort },
@@ -1884,12 +1906,14 @@
1884
1906
  repairs.push({ name: track.name, packetId });
1885
1907
  }
1886
1908
  if (repairOwners.length === 0) continue;
1909
+ const sender = asmSenderFilter(endpoint);
1910
+ const { atsc3: _tuned, ...untuned } = transport;
1887
1911
  companions.push({
1888
1912
  group: endpoint.groupAddress,
1889
1913
  source: endpoint.sourceAddress || "",
1890
- ...asmSenderFilter(endpoint),
1914
+ ...sender,
1891
1915
  port: Number(endpoint.port),
1892
- ...transport,
1916
+ ...sender.senderAddress ? untuned : transport,
1893
1917
  packetIds: normalizePacketIds(repairOwners.map((owner) => owner.packetId)),
1894
1918
  repairOwners,
1895
1919
  tracks: [...owners.map((owner) => ({ ...owner })), ...repairs]
@@ -1929,6 +1953,7 @@
1929
1953
  const amtRelayPort = positivePort2(String(config.amtRelayPort ?? "")) ?? (dialableRelay ? amt?.port ?? DEFAULT_AMT_RELAY_PORT : void 0);
1930
1954
  const packetIds = normalizePacketIds(config.packetIds);
1931
1955
  const pendingAmt = dialableRelay ? [] : amtNetworkSourceEntries(config.amtNetworkSource);
1956
+ const atsc3 = config.atsc3 ? catalogAtsc3NetworkSource({ ...config.atsc3, type: "atsc3" }) : void 0;
1932
1957
  return {
1933
1958
  group: config.group,
1934
1959
  source: config.source || "",
@@ -1952,13 +1977,15 @@
1952
1977
  // whoever wires that resolution adds `amtNetworkSource` to
1953
1978
  // `sameMulticastConfig` in the same change.
1954
1979
  ...pendingAmt.length > 0 ? { amtNetworkSource: pendingAmt } : {},
1980
+ ...atsc3 ? { atsc3 } : {},
1955
1981
  ...packetIds.length > 0 ? { packetIds } : {}
1956
1982
  };
1957
1983
  }
1958
1984
  function sameMulticastConfig(a, b) {
1959
1985
  const left = normalizeMulticastConfig(a);
1960
1986
  const right = normalizeMulticastConfig(b);
1961
- 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 ?? []));
1962
1989
  }
1963
1990
  function urlOverrideBlocksMulticastCandidate(candidateConfig, urlConfig = readPlayerMulticastConfig()) {
1964
1991
  if (!urlConfig) return false;