Commit e5181976 authored by John Rummell's avatar John Rummell Committed by Commit Bot

Don't set encryptionScheme if not specified

https://github.com/WICG/encrypted-media-encryption-scheme/blob/master/explainer.md
has been updated to state "If encryptionScheme from the application is null
or missing, the encryptionScheme fields in the returned configuration must
be null." So updating Chrome to match this.

BUG=852978
TEST=updated LayoutTest passes

Change-Id: I7c5c39b93018fdc8208df5f25c0ef6c4f60e83f5
Reviewed-on: https://chromium-review.googlesource.com/1102000Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Commit-Queue: John Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567818}
parent aecf63d0
...@@ -366,15 +366,11 @@ bool KeySystemConfigSelector::IsSupportedEncryptionScheme( ...@@ -366,15 +366,11 @@ bool KeySystemConfigSelector::IsSupportedEncryptionScheme(
const std::string& key_system, const std::string& key_system,
const EmeEncryptionScheme encryption_scheme) { const EmeEncryptionScheme encryption_scheme) {
switch (encryption_scheme) { switch (encryption_scheme) {
// https://github.com/WICG/encrypted-media-encryption-scheme/blob/master/explainer.md.
// "A missing or null value indicates that any encryption scheme is
// acceptable."
// "Even if the application does not specify an encryption scheme,
// MediaKeySystemAccess.getConfiguration() must fill in a supported
// value."
// As Chrome has always supported 'cenc', assume this if encryption
// scheme is not specified.
case EmeEncryptionScheme::kNotSpecified: case EmeEncryptionScheme::kNotSpecified:
// https://github.com/WICG/encrypted-media-encryption-scheme/blob/master/explainer.md.
// "A missing or null value indicates that any encryption scheme is
// acceptable."
return true;
case EmeEncryptionScheme::kCenc: case EmeEncryptionScheme::kCenc:
return key_systems_->IsEncryptionSchemeSupported(key_system, return key_systems_->IsEncryptionSchemeSupported(key_system,
EncryptionMode::kCenc); EncryptionMode::kCenc);
......
...@@ -114,17 +114,17 @@ ...@@ -114,17 +114,17 @@
expectTypeError([buildConfiguration({audio: 'invalid'}, {video: 'cbcs'})], expectTypeError([buildConfiguration({audio: 'invalid'}, {video: 'cbcs'})],
'Audio invalid scheme, Video valid'); 'Audio invalid scheme, Video valid');
// Test without encryptionScheme, which should default to "cenc". // Test without encryptionScheme.
expectSupport([buildConfiguration({audio: null})], expectSupport([buildConfiguration({audio: null})],
'cenc', undefined, 'Audio handles missing encryptionScheme'); null, undefined, 'Audio handles missing encryptionScheme');
expectSupport([buildConfiguration({video: null})], expectSupport([buildConfiguration({video: null})],
undefined, 'cenc', 'Video handles missing encryptionScheme'); undefined, null, 'Video handles missing encryptionScheme');
expectSupport([buildConfiguration({audio: null}, {video: null})], expectSupport([buildConfiguration({audio: null}, {video: null})],
'cenc', 'cenc', 'Audio and Video handles missing encryptionScheme'); null, null, 'Audio and Video handles missing encryptionScheme');
expectSupport([buildConfiguration({audio: 'cbcs'}, {video: null})], expectSupport([buildConfiguration({audio: 'cbcs'}, {video: null})],
'cbcs', 'cenc', 'Audio valid and Video missing'); 'cbcs', null, 'Audio valid and Video missing');
expectSupport([buildConfiguration({audio: null}, {video: 'cbcs'})], expectSupport([buildConfiguration({audio: null}, {video: 'cbcs'})],
'cenc', 'cbcs', 'Audio missing and Video valid'); null, 'cbcs', 'Audio missing and Video valid');
// Test with "", which is invalid. // Test with "", which is invalid.
expectTypeError([buildConfiguration({audio: ''})], expectTypeError([buildConfiguration({audio: ''})],
......
...@@ -73,28 +73,6 @@ static Vector<String> ConvertInitDataTypes( ...@@ -73,28 +73,6 @@ static Vector<String> ConvertInitDataTypes(
return result; return result;
} }
static String ConvertEncryptionScheme(
WebMediaKeySystemMediaCapability::EncryptionScheme encryption_scheme) {
switch (encryption_scheme) {
// https://github.com/WICG/encrypted-media-encryption-scheme/blob/master/explainer.md.
// "A missing or null value indicates that any encryption scheme is
// acceptable."
// "Even if the application does not specify an encryption scheme,
// MediaKeySystemAccess.getConfiguration() must fill in a supported
// value."
// As Chrome has always supported 'cenc', assume this if encryption
// scheme is not specified.
case WebMediaKeySystemMediaCapability::EncryptionScheme::kNotSpecified:
case WebMediaKeySystemMediaCapability::EncryptionScheme::kCenc:
return "cenc";
case WebMediaKeySystemMediaCapability::EncryptionScheme::kCbcs:
return "cbcs";
}
NOTREACHED();
return "";
}
static HeapVector<MediaKeySystemMediaCapability> ConvertCapabilities( static HeapVector<MediaKeySystemMediaCapability> ConvertCapabilities(
const WebVector<WebMediaKeySystemMediaCapability>& capabilities) { const WebVector<WebMediaKeySystemMediaCapability>& capabilities) {
HeapVector<MediaKeySystemMediaCapability> result(capabilities.size()); HeapVector<MediaKeySystemMediaCapability> result(capabilities.size());
...@@ -102,8 +80,19 @@ static HeapVector<MediaKeySystemMediaCapability> ConvertCapabilities( ...@@ -102,8 +80,19 @@ static HeapVector<MediaKeySystemMediaCapability> ConvertCapabilities(
MediaKeySystemMediaCapability capability; MediaKeySystemMediaCapability capability;
capability.setContentType(capabilities[i].content_type); capability.setContentType(capabilities[i].content_type);
capability.setRobustness(capabilities[i].robustness); capability.setRobustness(capabilities[i].robustness);
capability.setEncryptionScheme(
ConvertEncryptionScheme(capabilities[i].encryption_scheme)); switch (capabilities[i].encryption_scheme) {
case WebMediaKeySystemMediaCapability::EncryptionScheme::kNotSpecified:
capability.setEncryptionSchemeToNull();
break;
case WebMediaKeySystemMediaCapability::EncryptionScheme::kCenc:
capability.setEncryptionScheme("cenc");
break;
case WebMediaKeySystemMediaCapability::EncryptionScheme::kCbcs:
capability.setEncryptionScheme("cbcs");
break;
}
result[i] = capability; result[i] = capability;
} }
return result; return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment