Skip to content

Commit e573d81

Browse files
Stansbridgejoeyparrish
authored andcommitted
fix: Fix case sensitivity for drm content type (#2800)
This fixes the case sensitivity in the `DrmEngine` `willSupport` method. This comparison should be case insensitive, particularly for codec profiles described in hex which may be either lower or upper case. The change normalizes both the stored content types and the method arguments. Closes #2799
1 parent 41e63cf commit e573d81

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Adrián Gómez Llorente <adgllorente@gmail.com>
1818
Alex Jones <alexedwardjones@gmail.com>
1919
Alugha GmbH <*@alugha.com>
2020
Alvaro Velad Galvan <alvaro.velad@mirada.tv>
21+
Anthony Stansbridge <github@anthonystansbridge.co.uk>
2122
Bonnier Broadcasting <*@bonnierbroadcasting.com>
2223
Bryan Huh <bhh1988@gmail.com>
2324
Esteban Dosztal <edosztal@gmail.com>

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Aaron Vaage <vaage@google.com>
2626
Alex Jones <alexedwardjones@gmail.com>
2727
Alvaro Velad Galvan <alvaro.velad@mirada.tv>
2828
Andy Hochhaus <ahochhaus@samegoal.com>
29+
Anthony Stansbridge <github@anthonystansbridge.co.uk>
2930
Ashutosh Kumar Mukhiya <ashukm4@gmail.com>
3031
Benjamin Wallberg <benjamin.wallberg@bonnierbroadcasting.com>
3132
Boris Cupac <borisrt2309@gmail.com>

lib/media/drm_engine.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ shaka.media.DrmEngine = class {
582582
return true;
583583
}
584584

585-
return this.supportedTypes_.has(contentType);
585+
return this.supportedTypes_.has(contentType.toLowerCase());
586586
}
587587

588588
/**
@@ -831,11 +831,11 @@ shaka.media.DrmEngine = class {
831831
const videoCaps = realConfig.videoCapabilities || [];
832832

833833
for (const cap of audioCaps) {
834-
this.supportedTypes_.add(cap.contentType);
834+
this.supportedTypes_.add(cap.contentType.toLowerCase());
835835
}
836836

837837
for (const cap of videoCaps) {
838-
this.supportedTypes_.add(cap.contentType);
838+
this.supportedTypes_.add(cap.contentType.toLowerCase());
839839
}
840840

841841
goog.asserts.assert(this.supportedTypes_.size,

test/media/drm_engine_unit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ describe('DrmEngine', () => {
260260
expect(drmEngine.initialized()).toBe(true);
261261
expect(drmEngine.willSupport('audio/webm')).toBeTruthy();
262262
expect(drmEngine.willSupport('video/mp4; codecs="fake"')).toBeTruthy();
263+
expect(drmEngine.willSupport('video/mp4; codecs="FAKE"')).toBeTruthy();
263264

264265
// Because DrmEngine will err on being too accepting, make sure it will
265266
// reject something. However, we can only check that it is actually

0 commit comments

Comments
 (0)