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();