From 95ed20eaa6fd8aa55583b4c4f2a47292f47000e4 Mon Sep 17 00:00:00 2001 From: dsilhavy Date: Mon, 13 Jul 2020 13:58:02 +0200 Subject: [PATCH] =?UTF-8?q?Remove=20profiles=20from=20mimeType=20attribute?= =?UTF-8?q?=20as=20they=20will=20cause=20problems=20w=E2=80=A6=20(#3330)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove profiles from mimeType attribute as they will cause problems when doing capability checks * Add additional codec test to DashManifestModel --- src/dash/models/DashManifestModel.js | 5 +++++ test/unit/dash.models.DashManifestModel.js | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/dash/models/DashManifestModel.js b/src/dash/models/DashManifestModel.js index e25e941751..156b871c56 100644 --- a/src/dash/models/DashManifestModel.js +++ b/src/dash/models/DashManifestModel.js @@ -277,6 +277,11 @@ function DashManifestModel() { } } + // If the codec contains a profiles parameter we remove it. Otherwise it will cause problems when checking for codec capabilities of the platform + if (codec) { + codec = codec.replace(/\sprofiles=[^;]*/g, ''); + } + return codec; } diff --git a/test/unit/dash.models.DashManifestModel.js b/test/unit/dash.models.DashManifestModel.js index 324eaa786d..4ab6cff2fb 100644 --- a/test/unit/dash.models.DashManifestModel.js +++ b/test/unit/dash.models.DashManifestModel.js @@ -313,6 +313,18 @@ describe('DashManifestModel', function () { expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); // jshint ignore:line }); + it('should return correct codec without a correct mime type profile when getCodec is called and representationId is an integer and addResolutionInfo is false', () => { + const codec = dashManifestModel.getCodec({ Representation_asArray: [{mimeType: 'video/mp4 profiles="cmfc,cfhd"', codecs: 'avc1.4D400D', width: 1080, height: 960}] }, 0, false); + + expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); // jshint ignore:line + }); + + it('should return correct codec without an invalid mime type profile when getCodec is called and representationId is an integer and addResolutionInfo is false', () => { + const codec = dashManifestModel.getCodec({ Representation_asArray: [{mimeType: 'video/mp4 profiles="cmfc,cf', codecs: 'avc1.4D400D', width: 1080, height: 960}] }, 0, false); + + expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); // jshint ignore:line + }); + it('should return null when getMimeType is called and adaptation is undefined', () => { const mimeType = dashManifestModel.getMimeType();