Skip to content

Commit

Permalink
Remove profiles from mimeType attribute as they will cause problems w… (
Browse files Browse the repository at this point in the history
#3330)

* Remove profiles from mimeType attribute as they will cause problems when doing capability checks

* Add additional codec test to DashManifestModel
  • Loading branch information
dsilhavy committed Jul 13, 2020
1 parent 2592c96 commit 95ed20e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dash/models/DashManifestModel.js
Expand Up @@ -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;
}

Expand Down
12 changes: 12 additions & 0 deletions test/unit/dash.models.DashManifestModel.js
Expand Up @@ -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();

Expand Down

0 comments on commit 95ed20e

Please sign in to comment.