@mega-yfue/eufy-sdk 0.5.0-beta.60 → 0.5.0-beta.61
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.
package/dist/index.js
CHANGED
|
@@ -19635,7 +19635,7 @@ var SharedLiveSource = class {
|
|
|
19635
19635
|
stream.on("audio", (frame) => this.onAudio(frame));
|
|
19636
19636
|
stream.on("stop", () => this.onUpstreamEnd());
|
|
19637
19637
|
stream.on("error", (err) => this.onUpstreamError(err));
|
|
19638
|
-
stream.on("unacknowledged", () => this.
|
|
19638
|
+
stream.on("unacknowledged", () => this.askForFreshSession("start unacknowledged"));
|
|
19639
19639
|
stream.start();
|
|
19640
19640
|
}
|
|
19641
19641
|
/**
|
|
@@ -19654,30 +19654,31 @@ var SharedLiveSource = class {
|
|
|
19654
19654
|
this.armWarmWatch();
|
|
19655
19655
|
}
|
|
19656
19656
|
/**
|
|
19657
|
-
*
|
|
19657
|
+
* Ask the owner for a replacement session where nothing has been delivered yet, answering whether one is coming.
|
|
19658
19658
|
*
|
|
19659
|
-
*
|
|
19660
|
-
* 4–37 ms awake and 238 ms waking, so it is the session that is not being heard rather than a slow device
|
|
19661
|
-
*
|
|
19662
|
-
*
|
|
19659
|
+
* An unacknowledged start is roughly twenty byte-identical sends with no reply, against acknowledgement latencies
|
|
19660
|
+
* of 4–37 ms awake and 238 ms waking, so it is the session that is not being heard rather than a slow device: the
|
|
19661
|
+
* camera was never told to stream. Where media has already flowed the abandonment means something else and this
|
|
19662
|
+
* does nothing. The DEADLINE is left running: the window belongs to the attempt, not to the session it started on.
|
|
19663
19663
|
*
|
|
19664
|
-
* The retry ticker is stopped
|
|
19665
|
-
*
|
|
19666
|
-
* started on.
|
|
19664
|
+
* The retry ticker is stopped only once the owner has said it is replacing the session: an owner that cannot
|
|
19665
|
+
* (an attached camera shares its HomeBase session) leaves the source re-issuing as it always did.
|
|
19667
19666
|
*/
|
|
19668
|
-
|
|
19667
|
+
askForFreshSession(why) {
|
|
19669
19668
|
if (this.disposed || this.sessionReplacementAsked)
|
|
19670
|
-
return;
|
|
19669
|
+
return false;
|
|
19671
19670
|
if (this.delivered.video || this.delivered.audio || this.delivered.keyframe)
|
|
19672
|
-
return;
|
|
19671
|
+
return false;
|
|
19673
19672
|
if (!this.opts.onSessionUnreachable)
|
|
19674
|
-
return;
|
|
19673
|
+
return false;
|
|
19675
19674
|
this.sessionReplacementAsked = true;
|
|
19676
|
-
this.
|
|
19675
|
+
if (!this.opts.onSessionUnreachable())
|
|
19676
|
+
return false;
|
|
19677
|
+
this.logger.debug(`${this.tag} ${why} with nothing delivered \u2014 warming again on a fresh session`);
|
|
19677
19678
|
if (this.warmRetryTimer)
|
|
19678
19679
|
clearInterval(this.warmRetryTimer);
|
|
19679
19680
|
this.warmRetryTimer = void 0;
|
|
19680
|
-
|
|
19681
|
+
return true;
|
|
19681
19682
|
}
|
|
19682
19683
|
/**
|
|
19683
19684
|
* Warm again on a session the owner has replaced, inside the deadline the first attempt started.
|
|
@@ -19720,17 +19721,24 @@ var SharedLiveSource = class {
|
|
|
19720
19721
|
* {@link fruitlessReissues} for why one is not enough and why what the stream delivered earlier is not
|
|
19721
19722
|
* evidence. Once media arrives the keepalive is what is wanted, and an attached camera re-sends a full start
|
|
19722
19723
|
* either way.
|
|
19724
|
+
*
|
|
19725
|
+
* A forced start that a whole interval later has still produced nothing is a session that acknowledges and
|
|
19726
|
+
* does not serve: a fresh session on the same camera delivers a keyframe within a second, so a warm-up asks
|
|
19727
|
+
* for one rather than forcing starts onto this one until its deadline. Wired only: a cold battery camera is
|
|
19728
|
+
* slow rather than deaf, measured at about 8 s to first media, and replacing its session would cost a wake.
|
|
19723
19729
|
*/
|
|
19724
19730
|
reissueStart() {
|
|
19725
19731
|
const current = this.stream;
|
|
19726
19732
|
if (!current?.nudge)
|
|
19727
19733
|
return;
|
|
19728
|
-
this.warmAttempts++;
|
|
19729
19734
|
const arrivedSinceWatch = this.delivered.video || this.delivered.audio;
|
|
19730
19735
|
if (arrivedSinceWatch)
|
|
19731
19736
|
this.fruitlessReissues = 0;
|
|
19732
19737
|
else
|
|
19733
19738
|
this.fruitlessReissues++;
|
|
19739
|
+
if (this.fruitlessReissues > 2 && this._state === "warming" && this.powered === "wired" && this.askForFreshSession("forced start served nothing"))
|
|
19740
|
+
return;
|
|
19741
|
+
this.warmAttempts++;
|
|
19734
19742
|
current.nudge(!arrivedSinceWatch && this.fruitlessReissues > 1);
|
|
19735
19743
|
}
|
|
19736
19744
|
/**
|
|
@@ -22420,11 +22428,11 @@ var P2PCommandRouter = class _P2PCommandRouter {
|
|
|
22420
22428
|
void this.manager.close(station).catch((error) => this.reportError(error instanceof Error ? error : new Error(String(error)))).finally(() => this.dropLiveSource(key));
|
|
22421
22429
|
}
|
|
22422
22430
|
/**
|
|
22423
|
-
* Replace the session under a warming source
|
|
22431
|
+
* Replace the session under a warming source it is not serving, and warm again on it.
|
|
22424
22432
|
*
|
|
22425
22433
|
* Only a STANDALONE device's session is replaced, for the reason {@link onLiveStartFailed} gives: an attached
|
|
22426
22434
|
* camera shares its HomeBase session with every other camera on it, and closing that to recover one would
|
|
22427
|
-
* drop the rest. Such a source keeps the re-issue it always had.
|
|
22435
|
+
* drop the rest. Such a source keeps the re-issue it always had, which the answer (false) tells it.
|
|
22428
22436
|
*
|
|
22429
22437
|
* The source is left warming throughout, holding the deadline it started, so this either produces a stream
|
|
22430
22438
|
* within that window or fails exactly as it would have. A replacement that cannot be opened leaves the
|
|
@@ -22433,7 +22441,7 @@ var P2PCommandRouter = class _P2PCommandRouter {
|
|
|
22433
22441
|
replaceUnreachableSession(sn, key, held) {
|
|
22434
22442
|
const station = this.stationKeyOf(sn);
|
|
22435
22443
|
if (station !== sn)
|
|
22436
|
-
return;
|
|
22444
|
+
return false;
|
|
22437
22445
|
void (async () => {
|
|
22438
22446
|
try {
|
|
22439
22447
|
await this.manager.close(station);
|
|
@@ -22446,6 +22454,7 @@ var P2PCommandRouter = class _P2PCommandRouter {
|
|
|
22446
22454
|
this.reportError(error instanceof Error ? error : new Error(String(error)));
|
|
22447
22455
|
}
|
|
22448
22456
|
})();
|
|
22457
|
+
return true;
|
|
22449
22458
|
}
|
|
22450
22459
|
/**
|
|
22451
22460
|
* Warn when a caller asks for a shared source with options that disagree with the ones it was built
|