@apocaliss92/nodelink-js 0.6.6 → 0.6.8-beta.0

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.
@@ -0,0 +1,7 @@
1
+ import {
2
+ BaichuanVideoStream
3
+ } from "./chunk-4LZABN6I.js";
4
+ export {
5
+ BaichuanVideoStream
6
+ };
7
+ //# sourceMappingURL=BaichuanVideoStream-6Y2JSBLN.js.map
@@ -12,8 +12,8 @@ import {
12
12
  sampleStreams,
13
13
  sanitizeFixtureData,
14
14
  testChannelStreams
15
- } from "./chunk-IQVVVSXO.js";
16
- import "./chunk-MZUSWKF3.js";
15
+ } from "./chunk-27ZKJZFH.js";
16
+ import "./chunk-4LZABN6I.js";
17
17
  export {
18
18
  captureModelFixtures,
19
19
  collectCgiDiagnostics,
@@ -29,4 +29,4 @@ export {
29
29
  sanitizeFixtureData,
30
30
  testChannelStreams
31
31
  };
32
- //# sourceMappingURL=DiagnosticsTools-QJ3CRYGA.js.map
32
+ //# sourceMappingURL=DiagnosticsTools-G3S6L3FX.js.map
@@ -8,7 +8,7 @@ import {
8
8
  recordingsTraceLog,
9
9
  splitAnnexBToNalPayloads,
10
10
  splitAnnexBToNalPayloads2
11
- } from "./chunk-MZUSWKF3.js";
11
+ } from "./chunk-4LZABN6I.js";
12
12
 
13
13
  // src/debug/DiagnosticsTools.ts
14
14
  import * as fs2 from "fs";
@@ -5618,4 +5618,4 @@ export {
5618
5618
  parseRecordingFileName,
5619
5619
  ReolinkCgiApi
5620
5620
  };
5621
- //# sourceMappingURL=chunk-IQVVVSXO.js.map
5621
+ //# sourceMappingURL=chunk-27ZKJZFH.js.map
@@ -1548,6 +1548,14 @@ var BaichuanVideoStream = class _BaichuanVideoStream extends EventEmitter {
1548
1548
  logger;
1549
1549
  active = false;
1550
1550
  videoFrameHandler;
1551
+ // Fired when the underlying BaichuanClient socket closes/errors (e.g. the
1552
+ // keepalive watchdog tears down a half-open socket after a camera reboot).
1553
+ // Without this, the stream keeps believing it is active and only the idle
1554
+ // watchdog would (eventually, and uselessly) try to restart on a dead
1555
+ // client. Surfacing the socket death as a stream "close" lets the consumer
1556
+ // (createNativeStream → fanout onEnd → BaichuanRtspServer) rebuild the
1557
+ // stream on a fresh dedicated session.
1558
+ clientCloseHandler;
1551
1559
  expectedStreamTypes;
1552
1560
  activeMsgNum;
1553
1561
  cmdId;
@@ -2428,6 +2436,19 @@ var BaichuanVideoStream = class _BaichuanVideoStream extends EventEmitter {
2428
2436
  }
2429
2437
  };
2430
2438
  this.client.on("push", this.videoFrameHandler);
2439
+ this.clientCloseHandler = () => {
2440
+ if (!this.active) return;
2441
+ this.logger?.warn?.(
2442
+ `[BaichuanVideoStream] underlying socket closed (channel=${this.channel} profile=${this.profile}) \u2014 ending stream for rebuild`
2443
+ );
2444
+ this.active = false;
2445
+ this.stopWatchdog();
2446
+ if (this.videoFrameHandler)
2447
+ this.client.off("push", this.videoFrameHandler);
2448
+ this.videoFrameHandler = void 0;
2449
+ this.emit("close");
2450
+ };
2451
+ this.client.on("close", this.clientCloseHandler);
2431
2452
  this.active = true;
2432
2453
  this.startWatchdog();
2433
2454
  if (this.api && typeof this.api._registerVideoStreamForDetection === "function") {
@@ -2498,6 +2519,10 @@ var BaichuanVideoStream = class _BaichuanVideoStream extends EventEmitter {
2498
2519
  if (this.videoFrameHandler)
2499
2520
  this.client.off("push", this.videoFrameHandler);
2500
2521
  this.videoFrameHandler = void 0;
2522
+ if (this.clientCloseHandler) {
2523
+ this.client.off("close", this.clientCloseHandler);
2524
+ this.clientCloseHandler = void 0;
2525
+ }
2501
2526
  throw err;
2502
2527
  }
2503
2528
  this.emitSafeError(err);
@@ -2518,6 +2543,10 @@ var BaichuanVideoStream = class _BaichuanVideoStream extends EventEmitter {
2518
2543
  this.client.removeListener("push", this.videoFrameHandler);
2519
2544
  }
2520
2545
  this.videoFrameHandler = void 0;
2546
+ if (this.clientCloseHandler) {
2547
+ this.client.removeListener("close", this.clientCloseHandler);
2548
+ this.clientCloseHandler = void 0;
2549
+ }
2521
2550
  this.bcMediaCodec.clear();
2522
2551
  this.activeMsgNum = void 0;
2523
2552
  if (this.api) {
@@ -2728,4 +2757,4 @@ export {
2728
2757
  BcMediaAnnexBDecoder,
2729
2758
  BaichuanVideoStream
2730
2759
  };
2731
- //# sourceMappingURL=chunk-MZUSWKF3.js.map
2760
+ //# sourceMappingURL=chunk-4LZABN6I.js.map