@mega-yfue/eufy-sdk 0.4.0-beta.6 → 0.4.0-beta.8

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.
@@ -684,8 +684,8 @@ export interface SharedSourceHints {
684
684
  */
685
685
  powered?: "wired" | "battery";
686
686
  /**
687
- * Seconds of already-captured media the pull retains for a later drain; `0`, absent, non-finite and
688
- * negative values retain none.
687
+ * Seconds of already-captured media the pull retains for a later drain; `0`, absent, non-finite,
688
+ * negative, and windows longer than 2,147,483,647 ms retain none.
689
689
  *
690
690
  * Retention costs memory on every frame and only a caller knows whether anything will drain it, so it
691
691
  * is never assumed. Media can only be retained while the pull is running, so a window answers "what did
package/dist/index.js CHANGED
@@ -18221,9 +18221,9 @@ function annexbToJpeg(annexb, spawn2) {
18221
18221
 
18222
18222
  // dist/transport/p2p/shared-live-source.js
18223
18223
  import { EventEmitter as EventEmitter4 } from "node:events";
18224
- function durationMs(seconds) {
18225
- const milliseconds = (seconds ?? 0) * 1e3;
18226
- return Number.isFinite(milliseconds) && milliseconds > 0 ? milliseconds : 0;
18224
+ var MAX_TIMER_DELAY_MS = 2147483647;
18225
+ function timerMs(value, fallback) {
18226
+ return value !== void 0 && Number.isFinite(value) && value >= 1 && value <= MAX_TIMER_DELAY_MS ? value : fallback;
18227
18227
  }
18228
18228
  function sameConfig(a, b) {
18229
18229
  return b !== void 0 && a.codec === b.codec && a.width === b.width && a.height === b.height;
@@ -18476,14 +18476,14 @@ var SharedLiveSource = class {
18476
18476
  tag;
18477
18477
  constructor(opts) {
18478
18478
  this.opts = opts;
18479
- this.lingerMs = opts.lingerMs ?? 8e3;
18479
+ this.lingerMs = opts.lingerMs === 0 ? 1 : timerMs(opts.lingerMs, 8e3);
18480
18480
  this.maxQueue = opts.maxQueue ?? 900;
18481
- this.preBufferMs = durationMs(opts.preBufferSeconds);
18482
- this.warmRetryMs = opts.warmRetryMs ?? 2e3;
18483
- this.warmTimeoutMs = opts.warmTimeoutMs ?? 2e4;
18481
+ this.preBufferMs = timerMs((opts.preBufferSeconds ?? 0) * 1e3, 0);
18482
+ this.warmRetryMs = timerMs(opts.warmRetryMs, 2e3);
18483
+ this.warmTimeoutMs = timerMs(opts.warmTimeoutMs, 2e4);
18484
18484
  this.powered = opts.powered ?? "wired";
18485
- this.batteryBudgetMs = opts.batteryBudgetMs ?? 45e3;
18486
- this.budgetGraceMs = opts.budgetGraceMs ?? 1e4;
18485
+ this.batteryBudgetMs = timerMs(opts.batteryBudgetMs, 45e3);
18486
+ this.budgetGraceMs = timerMs(opts.budgetGraceMs, 1e4);
18487
18487
  this.logger = opts.logger ?? noopLogger;
18488
18488
  this.tag = opts.label ? `[live ${opts.label}]` : "[live]";
18489
18489
  this.traceId = `pull-${++pullSequence}`;
@@ -18731,7 +18731,7 @@ var SharedLiveSource = class {
18731
18731
  if (this.disposed || !this.stream)
18732
18732
  return;
18733
18733
  this.clearBudget();
18734
- this.budgetTimer.arm(ms ?? this.batteryBudgetMs, () => this.onBudgetExpire());
18734
+ this.budgetTimer.arm(timerMs(ms, this.batteryBudgetMs), () => this.onBudgetExpire());
18735
18735
  }
18736
18736
  /** Settle a reuse watch on any frame — the join already holds a decodable picture. */
18737
18737
  settleReuseWatch() {
@@ -18872,7 +18872,7 @@ var SharedLiveSource = class {
18872
18872
  return this.bufferedMedia(seconds).filter((item) => item.kind === "video").map((item) => item.frame);
18873
18873
  }
18874
18874
  bufferedMedia(seconds) {
18875
- const requested = Math.min(durationMs(seconds), this.preBufferMs);
18875
+ const requested = Number.isFinite(seconds) ? Math.min(seconds * 1e3, this.preBufferMs) : 0;
18876
18876
  if (requested <= 0 || !this.ring.length)
18877
18877
  return [];
18878
18878
  const start = this.windowStart(Date.now() - requested);