From c5e468745dff3bb47d85ac5ff973d480b0cfce48 Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Thu, 11 Apr 2024 12:49:19 +0200 Subject: [PATCH] Fix/throughput rule (#4450) * Fix a bug that causes period ID to be set to default when the ID is parsed as a date. * Account for null representation in ThroughputRule.js --- src/dash/models/DashManifestModel.js | 4 ++-- src/streaming/rules/abr/ThroughputRule.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dash/models/DashManifestModel.js b/src/dash/models/DashManifestModel.js index 161fef97fc..23b01dc485 100644 --- a/src/dash/models/DashManifestModel.js +++ b/src/dash/models/DashManifestModel.js @@ -892,8 +892,8 @@ function DashManifestModel() { let id = Period.DEFAULT_ID + '_' + i; - if (realPeriod.hasOwnProperty(DashConstants.ID) && realPeriod.id.length > 0 && realPeriod.id !== '__proto__') { - id = realPeriod.id; + if (realPeriod.hasOwnProperty(DashConstants.ID) && realPeriod.id.toString().length > 0 && realPeriod.id !== '__proto__') { + id = realPeriod.id.toString(); } return id; diff --git a/src/streaming/rules/abr/ThroughputRule.js b/src/streaming/rules/abr/ThroughputRule.js index 260280bccf..5964385bc5 100644 --- a/src/streaming/rules/abr/ThroughputRule.js +++ b/src/streaming/rules/abr/ThroughputRule.js @@ -72,7 +72,7 @@ function ThroughputRule(config) { switchRequest.reason = { throughput, latency, - message: `[ThroughputRule]: Switching to Representation with bitrate ${switchRequest.representation.bitrateInKbit} kbit/s. Throughput: ${throughput}` + message:`[ThroughputRule]: Switching to Representation with bitrate ${switchRequest.representation ? switchRequest.representation.bitrateInKbit : 'n/a'} kbit/s. Throughput: ${throughput}` }; scheduleController.setTimeToLoadDelay(0); }