From cdae681985fdc94925af025742876a87cca0c902 Mon Sep 17 00:00:00 2001 From: Andriy Lysnevych Date: Wed, 10 Jan 2024 17:15:01 +0200 Subject: [PATCH] Rename to queueDownloadRatio --- .../p2p-media-loader-core/src/hybrid-loader.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/p2p-media-loader-core/src/hybrid-loader.ts b/packages/p2p-media-loader-core/src/hybrid-loader.ts index 836d27b3..44876783 100644 --- a/packages/p2p-media-loader-core/src/hybrid-loader.ts +++ b/packages/p2p-media-loader-core/src/hybrid-loader.ts @@ -135,7 +135,7 @@ export class HybridLoader { private processRequests( queueSegmentIds: Set, - downloadProgressRatio: number + queueDownloadRatio: number ) { const { stream } = this.lastRequestedSegment; const { httpErrorRetries } = this.settings; @@ -163,7 +163,7 @@ export class HybridLoader { if (engineRequest) { engineRequest.resolve( request.data, - this.getBandwidth(downloadProgressRatio) + this.getBandwidth(queueDownloadRatio) ); this.engineRequest = undefined; } @@ -209,9 +209,8 @@ export class HybridLoader { } private processQueue() { - const { queue, queueSegmentIds, downloadProgressRatio } = - this.generateQueue(); - this.processRequests(queueSegmentIds, downloadProgressRatio); + const { queue, queueSegmentIds, queueDownloadRatio } = this.generateQueue(); + this.processRequests(queueSegmentIds, queueDownloadRatio); const { simultaneousHttpDownloads, @@ -429,12 +428,12 @@ export class HybridLoader { queueSegmentIds, maxPossibleLength, alreadyLoadedAmount, - downloadProgressRatio: + queueDownloadRatio: maxPossibleLength !== 0 ? alreadyLoadedAmount / maxPossibleLength : 0, }; } - private getBandwidth(downloadProgressRatio: number) { + private getBandwidth(queueDownloadRatio: number) { const { http, all } = this.bandwidthCalculators; const { activeLevelBitrate } = this.streamDetails; if (this.streamDetails.activeLevelBitrate === 0) { @@ -447,7 +446,7 @@ export class HybridLoader { all.getBandwidth(60, levelChangedTimestamp), all.getBandwidth(90, levelChangedTimestamp) ); - if (downloadProgressRatio >= 0.8 || bandwidth >= activeLevelBitrate * 0.9) { + if (queueDownloadRatio >= 0.8 || bandwidth >= activeLevelBitrate * 0.9) { return Math.max( all.getBandwidthLoadingOnly(1), all.getBandwidthLoadingOnly(3),