@torrent-tv/proxy 2.101.31 → 2.101.33
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/package.json
CHANGED
|
@@ -132,7 +132,9 @@ export class ViewerRequests {
|
|
|
132
132
|
const changed = this.#recordEarlyWaitSnapshot(context, context.features);
|
|
133
133
|
if (changed) context.revision += 1;
|
|
134
134
|
this.#pruneEarlyWaits();
|
|
135
|
-
const totalSeconds =
|
|
135
|
+
const totalSeconds = Number.isFinite(context.activeTotalSeconds)
|
|
136
|
+
? context.activeTotalSeconds
|
|
137
|
+
: this.#host.firstFrameSecondsOf?.(context.features) ?? null;
|
|
136
138
|
const seconds = earlyWaitRemainingSeconds(totalSeconds, waitElapsedSince(context, waitElapsedMs));
|
|
137
139
|
if (!Number.isFinite(seconds) || seconds < 0) return null;
|
|
138
140
|
return { version: 1, waitId, revision: context.revision, remainingSeconds: seconds, ageMs: 0 };
|
|
@@ -144,7 +146,9 @@ export class ViewerRequests {
|
|
|
144
146
|
const changed = this.#recordEarlyWaitSnapshot(context, context.features);
|
|
145
147
|
if (sameWait && changed) context.revision += 1;
|
|
146
148
|
this.#pruneEarlyWaits();
|
|
147
|
-
const totalSeconds =
|
|
149
|
+
const totalSeconds = Number.isFinite(context.activeTotalSeconds)
|
|
150
|
+
? context.activeTotalSeconds
|
|
151
|
+
: this.#host.firstFrameSecondsOf?.(context.features) ?? null;
|
|
148
152
|
const seconds = earlyWaitRemainingSeconds(totalSeconds, waitElapsedSince(context, waitElapsedMs));
|
|
149
153
|
if (!Number.isFinite(seconds) || seconds < 0) return null;
|
|
150
154
|
return { version: 1, waitId, revision: context.revision, remainingSeconds: seconds, ageMs: 0 };
|
|
@@ -187,14 +191,24 @@ export class ViewerRequests {
|
|
|
187
191
|
const revision = sameWait ? current.revision : 0;
|
|
188
192
|
const context = this.#setEarlyWait({ consumerId, generation, fileIndex, waitId, features, revision, current,
|
|
189
193
|
sourceObserved: true, waitElapsedMs });
|
|
190
|
-
const
|
|
194
|
+
const featuresChanged = this.#recordEarlyWaitSnapshot(context, context.features);
|
|
195
|
+
const elapsedMs = waitElapsedSince(context, waitElapsedMs);
|
|
196
|
+
const measuredWorkSeconds = processing.firstRequiredSegmentsSeconds;
|
|
197
|
+
const hasActiveEstimate = Number.isFinite(measuredWorkSeconds) && measuredWorkSeconds >= 0;
|
|
198
|
+
const activeTotalSeconds = hasActiveEstimate
|
|
199
|
+
? elapsedMs / 1000 + measuredWorkSeconds
|
|
200
|
+
: context.activeTotalSeconds;
|
|
201
|
+
const activeEstimateChanged = hasActiveEstimate && activeTotalSeconds !== context.activeTotalSeconds;
|
|
202
|
+
if (hasActiveEstimate) context.activeTotalSeconds = activeTotalSeconds;
|
|
203
|
+
const changed = featuresChanged || activeEstimateChanged;
|
|
191
204
|
if (sameWait && changed) context.revision += 1;
|
|
192
205
|
this.#pruneEarlyWaits();
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
const progressHasComponentForecast = Object.hasOwn(processing, "firstRequiredSegmentsSeconds");
|
|
207
|
+
let totalSeconds = activeTotalSeconds;
|
|
208
|
+
if (!Number.isFinite(totalSeconds) && !progressHasComponentForecast) {
|
|
209
|
+
totalSeconds = this.#host.firstFrameSecondsOf?.(context.features) ?? null;
|
|
210
|
+
}
|
|
211
|
+
const seconds = earlyWaitRemainingSeconds(totalSeconds, elapsedMs);
|
|
198
212
|
if (!Number.isFinite(seconds) || seconds < 0) return null;
|
|
199
213
|
return { version: 1, waitId, revision: context.revision, remainingSeconds: seconds, ageMs: 0 };
|
|
200
214
|
}
|