Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove profiles from mimeType attribute as they will cause problems w… #3330

Merged
merged 2 commits into from Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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