Relax string comparison in DASH parseContentProtection

... by making it case insensitive and null-tolerant for schemeId (as was before
adding playlist drm data merging).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174472123
This commit is contained in:
aquilescanta 2017-11-03 09:36:43 -07:00 committed by Oliver Woodman
parent 1cfea62545
commit ecaaed9674

View File

@ -345,30 +345,32 @@ public class DashManifestParser extends DefaultHandler
*/ */
protected Pair<String, SchemeData> parseContentProtection(XmlPullParser xpp) protected Pair<String, SchemeData> parseContentProtection(XmlPullParser xpp)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
String schemeIdUri = xpp.getAttributeValue(null, "schemeIdUri");
String schemeType = null; String schemeType = null;
byte[] data = null; byte[] data = null;
UUID uuid = null; UUID uuid = null;
boolean requiresSecureDecoder = false; boolean requiresSecureDecoder = false;
switch (schemeIdUri) { String schemeIdUri = xpp.getAttributeValue(null, "schemeIdUri");
case "urn:mpeg:dash:mp4protection:2011": if (schemeIdUri != null) {
schemeType = xpp.getAttributeValue(null, "value"); switch (schemeIdUri.toLowerCase()) {
String defaultKid = xpp.getAttributeValue(null, "cenc:default_KID"); case "urn:mpeg:dash:mp4protection:2011":
if (defaultKid != null && !"00000000-0000-0000-0000-000000000000".equals(defaultKid)) { schemeType = xpp.getAttributeValue(null, "value");
UUID keyId = UUID.fromString(defaultKid); String defaultKid = xpp.getAttributeValue(null, "cenc:default_KID");
data = PsshAtomUtil.buildPsshAtom(C.COMMON_PSSH_UUID, new UUID[] {keyId}, null); if (defaultKid != null && !"00000000-0000-0000-0000-000000000000".equals(defaultKid)) {
uuid = C.COMMON_PSSH_UUID; UUID keyId = UUID.fromString(defaultKid);
} data = PsshAtomUtil.buildPsshAtom(C.COMMON_PSSH_UUID, new UUID[] {keyId}, null);
break; uuid = C.COMMON_PSSH_UUID;
case "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": }
uuid = C.PLAYREADY_UUID; break;
break; case "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":
case "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": uuid = C.PLAYREADY_UUID;
uuid = C.WIDEVINE_UUID; break;
break; case "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":
default: uuid = C.WIDEVINE_UUID;
break; break;
default:
break;
}
} }
do { do {