From 86d4b7b9ec46761ef549acedfe30a9058ae21696 Mon Sep 17 00:00:00 2001 From: dsilhavy Date: Mon, 13 Jul 2020 13:42:58 +0200 Subject: [PATCH 1/2] Remove profiles from mimeType attribute as they will cause problems when doing capability checks --- src/dash/models/DashManifestModel.js | 5 +++++ test/unit/dash.models.DashManifestModel.js | 6 ++++++ 2 files changed, 11 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..4ca9d09633 100644 --- a/test/unit/dash.models.DashManifestModel.js +++ b/test/unit/dash.models.DashManifestModel.js @@ -313,6 +313,12 @@ describe('DashManifestModel', function () { expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); // jshint ignore:line }); + it('should return correct codec without the 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 null when getMimeType is called and adaptation is undefined', () => { const mimeType = dashManifestModel.getMimeType(); From c5533b92af8ebecbf62e921248347af8e7030f40 Mon Sep 17 00:00:00 2001 From: dsilhavy Date: Mon, 13 Jul 2020 13:52:41 +0200 Subject: [PATCH 2/2] Add additional codec test to DashManifestModel --- test/unit/dash.models.DashManifestModel.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/unit/dash.models.DashManifestModel.js b/test/unit/dash.models.DashManifestModel.js index 4ca9d09633..4ab6cff2fb 100644 --- a/test/unit/dash.models.DashManifestModel.js +++ b/test/unit/dash.models.DashManifestModel.js @@ -313,12 +313,18 @@ describe('DashManifestModel', function () { expect(codec).to.be.equal('video/mp4;codecs="avc1.4D400D"'); // jshint ignore:line }); - it('should return correct codec without the mime type profile when getCodec is called and representationId is an integer and addResolutionInfo is false', () => { + 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();