@apocaliss92/nodelink-js 0.5.1-beta.2 → 0.5.1-beta.3

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.
@@ -12,7 +12,7 @@ import {
12
12
  sampleStreams,
13
13
  sanitizeFixtureData,
14
14
  testChannelStreams
15
- } from "./chunk-AHY4L7JI.js";
15
+ } from "./chunk-VOPEOB4H.js";
16
16
  import "./chunk-GVWJGQPT.js";
17
17
  export {
18
18
  captureModelFixtures,
@@ -29,4 +29,4 @@ export {
29
29
  sanitizeFixtureData,
30
30
  testChannelStreams
31
31
  };
32
- //# sourceMappingURL=DiagnosticsTools-ILDDJZL7.js.map
32
+ //# sourceMappingURL=DiagnosticsTools-7BIWJDZS.js.map
@@ -30,7 +30,7 @@ import {
30
30
  runAllDiagnosticsConsecutively,
31
31
  runMultifocalDiagnosticsConsecutively,
32
32
  xmlEscape
33
- } from "./chunk-AHY4L7JI.js";
33
+ } from "./chunk-VOPEOB4H.js";
34
34
  import {
35
35
  BC_CLASS_FILE_DOWNLOAD,
36
36
  BC_CLASS_LEGACY,
@@ -20165,7 +20165,7 @@ ${xml}`
20165
20165
  * @returns Test results for all stream types and profiles
20166
20166
  */
20167
20167
  async testChannelStreams(channel, logger) {
20168
- const { testChannelStreams } = await import("./DiagnosticsTools-ILDDJZL7.js");
20168
+ const { testChannelStreams } = await import("./DiagnosticsTools-7BIWJDZS.js");
20169
20169
  return await testChannelStreams({
20170
20170
  api: this,
20171
20171
  channel: this.normalizeChannel(channel),
@@ -20181,7 +20181,7 @@ ${xml}`
20181
20181
  * @returns Complete diagnostics for all channels and streams
20182
20182
  */
20183
20183
  async collectMultifocalDiagnostics(logger) {
20184
- const { collectMultifocalDiagnostics } = await import("./DiagnosticsTools-ILDDJZL7.js");
20184
+ const { collectMultifocalDiagnostics } = await import("./DiagnosticsTools-7BIWJDZS.js");
20185
20185
  return await collectMultifocalDiagnostics({
20186
20186
  api: this,
20187
20187
  logger
@@ -24825,4 +24825,4 @@ export {
24825
24825
  isTcpFailureThatShouldFallbackToUdp,
24826
24826
  autoDetectDeviceType
24827
24827
  };
24828
- //# sourceMappingURL=chunk-6ILAHQF5.js.map
24828
+ //# sourceMappingURL=chunk-SNLZ45EF.js.map
@@ -13,6 +13,7 @@ import {
13
13
  // src/debug/DiagnosticsTools.ts
14
14
  import * as fs2 from "fs";
15
15
  import * as path2 from "path";
16
+ import { createHash } from "crypto";
16
17
  import { spawn } from "child_process";
17
18
 
18
19
  // src/reolink/baichuan/recordingFileName.ts
@@ -4350,11 +4351,36 @@ async function runMultifocalDiagnosticsConsecutively(params) {
4350
4351
  onNvr: params.onNvr !== false
4351
4352
  })
4352
4353
  );
4354
+ const maxStandaloneChannels = Math.max(
4355
+ 1,
4356
+ params.maxStandaloneChannels ?? (params.probeFull ? 4 : 2)
4357
+ );
4358
+ const candidateChannels = [];
4359
+ for (let i = 0; i < maxStandaloneChannels; i++) candidateChannels.push(i);
4360
+ if (Number.isFinite(params.channel) && params.channel >= 0 && !candidateChannels.includes(params.channel)) {
4361
+ candidateChannels.push(params.channel);
4362
+ }
4363
+ results.channelProbe = {};
4364
+ for (const ch of candidateChannels) {
4365
+ const probe = { channel: ch };
4366
+ probe.getDeviceCapabilities = await tryCall(
4367
+ () => params.api.getDeviceCapabilities(ch)
4368
+ );
4369
+ probe.getEncXml = await tryCall(() => params.api.getEncXml(ch));
4370
+ probe.getStreamMetadata = await tryCall(
4371
+ () => params.api.getStreamMetadata(ch)
4372
+ );
4373
+ const described = (probe.getDeviceCapabilities?.ok ?? false) || (probe.getEncXml?.ok ?? false) || (probe.getStreamMetadata?.ok ?? false);
4374
+ probe.describedByMetadata = described;
4375
+ results.channelProbe[String(ch)] = probe;
4376
+ }
4353
4377
  const nativeModes = params.onNvr === false && !params.probeFull ? ["standalone"] : ["nvr", "standalone"];
4354
4378
  const uniqNums = (arr) => [...new Set(arr)].filter((n) => Number.isFinite(n) && n >= 0);
4355
4379
  const channelsForMode = (mode) => {
4356
4380
  if (mode === "nvr") return [params.channel];
4357
- return uniqNums([0, 1, params.channel].filter((n) => n === 0 || n === 1));
4381
+ const range = [];
4382
+ for (let i = 0; i < maxStandaloneChannels; i++) range.push(i);
4383
+ return uniqNums([...range, params.channel]);
4358
4384
  };
4359
4385
  const nativeProfiles = params.probeFull ? ["main", "sub", "ext"] : ["main", "sub"];
4360
4386
  const nativeVariants = params.probeFull ? ["default", "autotrack", "telephoto"] : ["default"];
@@ -4415,6 +4441,8 @@ async function runMultifocalDiagnosticsConsecutively(params) {
4415
4441
  let rawBytes = 0;
4416
4442
  let lockedChannelId;
4417
4443
  let lockedMsgNum;
4444
+ let firstKeyframeSha;
4445
+ let firstKeyframeBytes;
4418
4446
  const onPush = (frame) => {
4419
4447
  if (!frame?.header) return;
4420
4448
  if (frame.header.cmdId !== 3) return;
@@ -4488,6 +4516,10 @@ async function runMultifocalDiagnosticsConsecutively(params) {
4488
4516
  }
4489
4517
  if (u.isKeyframe && firstKeyframeAtMs == null)
4490
4518
  firstKeyframeAtMs = Date.now();
4519
+ if (u.isKeyframe && firstKeyframeSha === void 0) {
4520
+ firstKeyframeBytes = u.data.length;
4521
+ firstKeyframeSha = createHash("sha256").update(u.data).digest("hex");
4522
+ }
4491
4523
  const nalTypes = nalTypesSummary(u.videoType, u.data);
4492
4524
  appendNdjson(eventsPath, {
4493
4525
  t: Date.now(),
@@ -4810,6 +4842,8 @@ async function runMultifocalDiagnosticsConsecutively(params) {
4810
4842
  rawBytes,
4811
4843
  lockedChannelId,
4812
4844
  lockedMsgNum,
4845
+ firstKeyframeSha: firstKeyframeSha ?? null,
4846
+ firstKeyframeBytes: firstKeyframeBytes ?? null,
4813
4847
  annexbPath: clipAnnexBPath,
4814
4848
  audioPath: clipAudioPath,
4815
4849
  mkvPath: fs2.existsSync(mkvPath) ? mkvPath : void 0
@@ -4878,10 +4912,45 @@ async function runMultifocalDiagnosticsConsecutively(params) {
4878
4912
  width: x.width,
4879
4913
  height: x.height
4880
4914
  }));
4915
+ const groups = /* @__PURE__ */ new Map();
4916
+ for (const x of results.ok) {
4917
+ if (x.kind !== "native") continue;
4918
+ const sha = x.firstKeyframeSha ?? null;
4919
+ if (!sha) continue;
4920
+ const key = `${x.mode}::${x.profile}::${x.variant}`;
4921
+ let g = groups.get(key);
4922
+ if (!g) {
4923
+ g = {
4924
+ mode: x.mode,
4925
+ profile: x.profile,
4926
+ variant: x.variant,
4927
+ fingerprints: {}
4928
+ };
4929
+ groups.set(key, g);
4930
+ }
4931
+ const bucket = g.fingerprints[sha] ?? [];
4932
+ bucket.push(x.channel);
4933
+ g.fingerprints[sha] = bucket;
4934
+ }
4935
+ results.channelComparison = Array.from(groups.values()).map((g) => {
4936
+ const buckets = Object.entries(g.fingerprints).map(([sha, channels]) => ({
4937
+ sha,
4938
+ channels: [...channels].sort((a, b) => a - b)
4939
+ }));
4940
+ return {
4941
+ mode: g.mode,
4942
+ profile: g.profile,
4943
+ variant: g.variant,
4944
+ distinct: buckets.length > 1,
4945
+ buckets
4946
+ };
4947
+ });
4881
4948
  log("log", "[MultifocalDiagnostics] summary", {
4882
4949
  ok: results.ok.length,
4883
4950
  failed: results.failed.length,
4884
4951
  streamsDir,
4952
+ channelProbeChannels: Object.keys(results.channelProbe ?? {}),
4953
+ channelComparison: results.channelComparison,
4885
4954
  okStreams: okIds
4886
4955
  });
4887
4956
  const resultsPath = join3(runDir, "multifocal_diagnostics.json");
@@ -5517,4 +5586,4 @@ export {
5517
5586
  parseRecordingFileName,
5518
5587
  ReolinkCgiApi
5519
5588
  };
5520
- //# sourceMappingURL=chunk-AHY4L7JI.js.map
5589
+ //# sourceMappingURL=chunk-VOPEOB4H.js.map