Bug 1283666 - Remove code to handle obsolete MediaKeySystemConfiguration attributes. r=jwwang

MozReview-Commit-ID: 1T3DH0JVstQ

--HG--
extra : source : f2d2fd02cdba4bd5c3c60c4005c852c3ee12ee9e
This commit is contained in:
Chris Pearce 2016-07-01 11:26:29 +12:00
parent 4bada5f9a0
commit 0405241de4
6 changed files with 3 additions and 120 deletions

View File

@ -2747,18 +2747,6 @@ ToCString(const MediaKeySystemConfiguration& aConfig)
str.Append(ToCString(aConfig.mVideoCapabilities.Value()));
}
if (!aConfig.mAudioType.IsEmpty()) {
str.AppendPrintf(", audioType='%s'",
NS_ConvertUTF16toUTF8(aConfig.mAudioType).get());
}
if (!aConfig.mInitDataType.IsEmpty()) {
str.AppendPrintf(", initDataType='%s'",
NS_ConvertUTF16toUTF8(aConfig.mInitDataType).get());
}
if (!aConfig.mVideoType.IsEmpty()) {
str.AppendPrintf(", videoType='%s'",
NS_ConvertUTF16toUTF8(aConfig.mVideoType).get());
}
str.AppendLiteral("}");
return str;

View File

@ -499,36 +499,6 @@ IsSupportedVideo(mozIGeckoMediaPluginService* aGMPService,
return false;
}
static bool
IsSupported(mozIGeckoMediaPluginService* aGMPService,
const nsAString& aKeySystem,
const MediaKeySystemConfiguration& aConfig,
DecoderDoctorDiagnostics* aDiagnostics)
{
if (aConfig.mInitDataType.IsEmpty() &&
aConfig.mAudioType.IsEmpty() &&
aConfig.mVideoType.IsEmpty()) {
// Not an old-style request.
return false;
}
// Backwards compatibility with legacy MediaKeySystemConfiguration method.
if (!aConfig.mInitDataType.IsEmpty() &&
!aConfig.mInitDataType.EqualsLiteral("cenc")) {
return false;
}
if (!aConfig.mAudioType.IsEmpty() &&
!IsSupportedAudio(aGMPService, aKeySystem, aConfig.mAudioType, aDiagnostics)) {
return false;
}
if (!aConfig.mVideoType.IsEmpty() &&
!IsSupportedVideo(aGMPService, aKeySystem, aConfig.mVideoType, aDiagnostics)) {
return false;
}
return true;
}
static bool
IsSupportedInitDataType(const nsString& aCandidate, const nsAString& aKeySystem)
{
@ -609,34 +579,6 @@ GetSupportedConfig(mozIGeckoMediaPluginService* aGMPService,
return true;
}
// Backwards compatibility with legacy requestMediaKeySystemAccess with fields
// from old MediaKeySystemOptions dictionary.
/* static */
bool
MediaKeySystemAccess::IsSupported(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
DecoderDoctorDiagnostics* aDiagnostics)
{
nsCOMPtr<mozIGeckoMediaPluginService> mps =
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
if (NS_WARN_IF(!mps)) {
return false;
}
if (!HaveGMPFor(mps,
NS_ConvertUTF16toUTF8(aKeySystem),
NS_LITERAL_CSTRING(GMP_API_DECRYPTOR))) {
return false;
}
for (const MediaKeySystemConfiguration& config : aConfigs) {
if (mozilla::dom::IsSupported(mps, aKeySystem, config, aDiagnostics)) {
return true;
}
}
return false;
}
/* static */
bool
MediaKeySystemAccess::GetSupportedConfig(const nsAString& aKeySystem,

View File

@ -169,10 +169,7 @@ MediaKeySystemAccessManager::Request(DetailedPromise* aPromise,
}
MediaKeySystemConfiguration config;
// TODO: Remove IsSupported() check here once we remove backwards
// compatibility with initial implementation...
if (MediaKeySystemAccess::GetSupportedConfig(keySystem, aConfigs, config, &diagnostics) ||
MediaKeySystemAccess::IsSupported(keySystem, aConfigs, &diagnostics)) {
if (MediaKeySystemAccess::GetSupportedConfig(keySystem, aConfigs, config, &diagnostics)) {
RefPtr<MediaKeySystemAccess> access(
new MediaKeySystemAccess(mWindow, keySystem, NS_ConvertUTF8toUTF16(cdmVersion), config));
aPromise->MaybeResolve(access);

View File

@ -19,7 +19,7 @@ const keysystem = 'org.w3.clearkey';
function createAndSet() {
return new Promise(function(resolve, reject) {
var m;
navigator.requestMediaKeySystemAccess(keysystem, [{initDataType: 'cenc'}])
navigator.requestMediaKeySystemAccess(keysystem, [{initDataTypes: ['cenc']}])
.then(function (access) {
return access.createMediaKeys();
}).then(function (mediaKeys) {

View File

@ -108,7 +108,7 @@ function PrepareInitData(initDataType, initData)
function Test(test) {
return new Promise(function(resolve, reject) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{initDataTypes: ['keyids']}]).then(
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{initDataTypes: [test.initDataType]}]).then(
(access) => access.createMediaKeys()
).then(
(mediaKeys) => {

View File

@ -528,50 +528,6 @@ var tests = [
],
shouldPass: false
},
// Test legacy support. Remove when we remove backwards compatibility.
{
name: 'Legacy CENC',
keySystem: CLEARKEY_ID,
options: [
{
initDataType: 'cenc',
}
],
expectedConfig: {
label: ''
},
shouldPass: true,
},
{
name: 'Legacy CENC + MP4 video',
keySystem: CLEARKEY_ID,
options: [
{
initDataType: 'cenc',
videoType: 'video/mp4; codecs="avc1.42E01E"',
}
],
expectedConfig: {
label: ''
},
shouldPass: true,
},
{
name: 'Legacy CENC + MP4 video + MP4 audio',
keySystem: CLEARKEY_ID,
options: [
{
initDataType: 'cenc',
videoType: 'video/mp4; codecs="avc1.42E01E"',
audioType: 'audio/mp4; codecs="mp4a.40.2"',
}
],
expectedConfig: {
label: ''
},
shouldPass: true,
},
];
function beginTest() {