@mega-yfue/eufy-sdk 0.5.0-beta.33 → 0.5.0-beta.34
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 +14 -9
- package/dist/index.js.map +2 -2
- package/dist/transport/p2p/fmp4.d.ts +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20419,7 +20419,8 @@ var Fmp4Muxer = class {
|
|
|
20419
20419
|
fragTicks = 0;
|
|
20420
20420
|
// ticks accumulated in the open fragment
|
|
20421
20421
|
samples = [];
|
|
20422
|
-
|
|
20422
|
+
/** Ticks from the first video sample's start to the newest sample's end, at its provisional duration. */
|
|
20423
|
+
videoTicks = 0;
|
|
20423
20424
|
audioRequested;
|
|
20424
20425
|
audioCodec;
|
|
20425
20426
|
/** Decoder config of an AAC-ELD track, taken from its frames; absent for AAC-LC, whose `esds` config is fixed. */
|
|
@@ -20443,6 +20444,10 @@ var Fmp4Muxer = class {
|
|
|
20443
20444
|
* Push one access unit. Returns any completed segments: the `init` on the first keyframe, and/or a
|
|
20444
20445
|
* media fragment when this frame closed the open one. Returns `undefined` if nothing is emitted yet
|
|
20445
20446
|
* (e.g. delta frames before the first keyframe).
|
|
20447
|
+
*
|
|
20448
|
+
* A sample lasts until the next frame's `timestampMs`, measured from the first keyframe's, so the video
|
|
20449
|
+
* timeline follows the arrival clock; a frame that shares the previous one's timestamp leaves that
|
|
20450
|
+
* sample one tick long, and the next frame's duration absorbs the difference.
|
|
20446
20451
|
*/
|
|
20447
20452
|
push(frame, timestampMs = now()) {
|
|
20448
20453
|
if (frame.codec === "av1")
|
|
@@ -20461,15 +20466,14 @@ var Fmp4Muxer = class {
|
|
|
20461
20466
|
this.height = declared?.height ?? frame.height;
|
|
20462
20467
|
this.firstVideoTimestampMs = timestampMs;
|
|
20463
20468
|
}
|
|
20464
|
-
if (this.
|
|
20465
|
-
const
|
|
20466
|
-
|
|
20467
|
-
|
|
20468
|
-
|
|
20469
|
-
|
|
20470
|
-
|
|
20469
|
+
if (this.firstVideoTimestampMs !== void 0 && this.samples.length) {
|
|
20470
|
+
const previous = this.samples[this.samples.length - 1];
|
|
20471
|
+
const arrival = Math.round((timestampMs - this.firstVideoTimestampMs) * (TIMESCALE / 1e3));
|
|
20472
|
+
const duration = Math.max(1, arrival - (this.videoTicks - previous.duration));
|
|
20473
|
+
this.fragTicks += duration - previous.duration;
|
|
20474
|
+
this.videoTicks += duration - previous.duration;
|
|
20475
|
+
previous.duration = duration;
|
|
20471
20476
|
}
|
|
20472
|
-
this.lastVideoTimestampMs = timestampMs;
|
|
20473
20477
|
let fragment;
|
|
20474
20478
|
if (frame.keyframe && this.samples.length > 0 && this.fragTicks >= this.fragmentTicks) {
|
|
20475
20479
|
if (!this.initSent) {
|
|
@@ -20481,6 +20485,7 @@ var Fmp4Muxer = class {
|
|
|
20481
20485
|
}
|
|
20482
20486
|
this.samples.push({ data: annexbToAvcc(frame.data), duration: this.firstDuration, keyframe: frame.keyframe });
|
|
20483
20487
|
this.fragTicks += this.firstDuration;
|
|
20488
|
+
this.videoTicks += this.firstDuration;
|
|
20484
20489
|
if (!this.initSent && (!this.audioRequested || this.audioCodec || this.audioDisabled)) {
|
|
20485
20490
|
init = this.buildInit();
|
|
20486
20491
|
this.initSent = true;
|