зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1044742 - Backout 8f13101a6dbb on a CLOSED TREE - r=bustage
This commit is contained in:
Родитель
bc0c8885af
Коммит
fa5ef650c8
|
@ -629,20 +629,6 @@ var gMetadataTests = [
|
|||
},
|
||||
];
|
||||
|
||||
// Test files for Encrypted Media Extensions
|
||||
var gEMETests = [
|
||||
{
|
||||
name:"short-cenc.mp4",
|
||||
type:"video/mp4",
|
||||
keys: {
|
||||
// "keyid" : "key"
|
||||
"7e571d017e571d017e571d017e571d01" : "7e5711117e5711117e5711117e571111",
|
||||
"7e571d027e571d027e571d027e571d02" : "7e5722227e5722227e5722227e572222",
|
||||
},
|
||||
sessionType:"temporary",
|
||||
},
|
||||
];
|
||||
|
||||
function checkMetadata(msg, e, test) {
|
||||
if (test.width) {
|
||||
is(e.videoWidth, test.width, msg + " video width");
|
||||
|
|
|
@ -219,7 +219,6 @@ support-files =
|
|||
seek_support.js
|
||||
seekLies.sjs
|
||||
seek_with_sound.ogg^headers^
|
||||
short-cenc.mp4
|
||||
short-video.ogv
|
||||
short-video.ogv^headers^
|
||||
small-shot-mp3.mp4
|
||||
|
@ -340,8 +339,6 @@ skip-if = toolkit == 'gonk' && debug
|
|||
[test_defaultMuted.html]
|
||||
[test_delay_load.html]
|
||||
skip-if = buildapp == 'b2g' # bug 1021676
|
||||
[test_encryptedMediaExtensions.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' # bug 1043403
|
||||
[test_error_in_video_document.html]
|
||||
skip-if = toolkit == 'android' # bug 608634
|
||||
[test_error_on_404.html]
|
||||
|
|
Двоичные данные
content/media/test/short-cenc.mp4
Двоичные данные
content/media/test/short-cenc.mp4
Двоичный файл не отображается.
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
This XML file describes the encryption applied to short-cenc.mp4. To generate
|
||||
short-cenc, run the following command:
|
||||
|
||||
MP4Box -crypt short-cenc.xml -out short-cenc.mp4 short.mp4
|
||||
-->
|
||||
|
||||
<GPACDRM type="CENC AES-CTR">
|
||||
|
||||
<DRMInfo type="pssh" version="1">
|
||||
<!--
|
||||
SystemID specified in
|
||||
https://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/cenc-format.html
|
||||
-->
|
||||
<BS ID128="1077efecc0b24d02ace33c1e52e2fb4b" />
|
||||
<!-- Number of KeyIDs = 2 -->
|
||||
<BS bits="32" value="2" />
|
||||
<!-- KeyID -->
|
||||
<BS ID128="0x7e571d017e571d017e571d017e571d01" />
|
||||
<BS ID128="0x7e571d027e571d027e571d027e571d02" />
|
||||
</DRMInfo>
|
||||
|
||||
<CrypTrack trackID="1" isEncrypted="1" IV_size="16" saiSavedBox="senc"
|
||||
first_IV="0x00000000000000000000000000000000">
|
||||
<key KID="0x7e571d017e571d017e571d017e571d01"
|
||||
value="0x7e5711117e5711117e5711117e571111" />
|
||||
</CrypTrack>
|
||||
|
||||
<CrypTrack trackID="2" isEncrypted="1" IV_size="16" saiSavedBox="senc"
|
||||
first_IV="0x00000000000000000000000000000000">
|
||||
<key KID="0x7e571d027e571d027e571d027e571d02"
|
||||
value="0x7e5722227e5722227e5722227e572222" />
|
||||
</CrypTrack>
|
||||
|
||||
</GPACDRM>
|
Двоичные данные
content/media/test/short.mp4
Двоичные данные
content/media/test/short.mp4
Двоичный файл не отображается.
|
@ -1,160 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test Encrypted Media Extensions</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var manager = new MediaTestManager;
|
||||
|
||||
const KEYSYSTEM_TYPE = "org.w3.clearkey";
|
||||
|
||||
function bail(message)
|
||||
{
|
||||
return function(err) {
|
||||
ok(false, message);
|
||||
if (err) {
|
||||
info(err);
|
||||
}
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function ArrayBufferToString(arr)
|
||||
{
|
||||
var str = '';
|
||||
var view = Uint8Array(arr);
|
||||
for (var i = 0; i < view.length; i++) {
|
||||
str += String.fromCharCode(view[i]);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function StringToArrayBuffer(str)
|
||||
{
|
||||
var arr = ArrayBuffer(str.length);
|
||||
var view = Uint8Array(arr);
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
view[i] = str.charCodeAt(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
function Base64ToHex(str)
|
||||
{
|
||||
var bin = window.atob(str.replace(/-/g, "+").replace(/_/g, "/"));
|
||||
var res = "";
|
||||
for (var i = 0; i < bin.length; i++) {
|
||||
res += ("0" + bin.charCodeAt(i).toString(16)).substr(-2);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function HexToBase64(hex)
|
||||
{
|
||||
var bin = "";
|
||||
for (var i = 0; i < hex.length; i += 2) {
|
||||
bin += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
|
||||
}
|
||||
return window.btoa(bin).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
||||
}
|
||||
|
||||
function UpdateSessionFunc(test) {
|
||||
return function(ev) {
|
||||
var msgStr = ArrayBufferToString(ev.message);
|
||||
var msg = JSON.parse(msgStr);
|
||||
|
||||
info("got message from CDM: " + msgStr);
|
||||
is(msg.type, test.sessionType, "Key session type should match");
|
||||
ok(msg.kids, "message event should contain key ID array");
|
||||
|
||||
var outKeys = [];
|
||||
|
||||
for (var i = 0; i < msg.kids.length; i++) {
|
||||
var id64 = msg.kids[i];
|
||||
var idHex = Base64ToHex(msg.kids[i]).toLowerCase();
|
||||
var key = test.keys[idHex];
|
||||
|
||||
if (key) {
|
||||
info("found key " + key + " for key id " + idHex);
|
||||
outKeys.push({
|
||||
"kty":"oct",
|
||||
"alg":"A128KW",
|
||||
"kid":id64,
|
||||
"k":HexToBase64(key)
|
||||
});
|
||||
} else {
|
||||
bail("Couldn't find key for key id " + idHex);
|
||||
}
|
||||
}
|
||||
|
||||
var update = JSON.stringify({
|
||||
"keys" : outKeys,
|
||||
"type" : msg.type
|
||||
});
|
||||
info("sending update message to CDM: " + update);
|
||||
|
||||
ev.target.update(StringToArrayBuffer(update)).then(function() {
|
||||
info("MediaKeySession update ok!");
|
||||
}, bail("MediaKeySession update failed"));
|
||||
}
|
||||
}
|
||||
|
||||
function startTest(test, token)
|
||||
{
|
||||
var v = document.createElement("video");
|
||||
manager.started(token);
|
||||
|
||||
v.addEventListener("encrypted", function(ev) {
|
||||
info("got encrypted event");
|
||||
ok(MediaKeys.isTypeSupported(KEYSYSTEM_TYPE, ev.initDataType, test.type),
|
||||
"MediaKeys should support this keysystem");
|
||||
|
||||
MediaKeys.create(KEYSYSTEM_TYPE).then(function(mediaKeys) {
|
||||
info("created MediaKeys object ok");
|
||||
return v.setMediaKeys(mediaKeys);
|
||||
}, bail("failed to create MediaKeys object")).then(function() {
|
||||
info("set MediaKeys on <video> element ok");
|
||||
|
||||
var session = v.mediaKeys.createSession(test.sessionType);
|
||||
session.addEventListener("message", UpdateSessionFunc(test));
|
||||
session.generateRequest(ev.initDataType, ev.initData).then(function() {
|
||||
}, bail("Failed to initialise MediaKeySession"));
|
||||
|
||||
}, bail("Failed to set MediaKeys on <video> element"));
|
||||
});
|
||||
|
||||
v.addEventListener("ended", function(ev) {
|
||||
ok(true, "got ended event");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
v.addEventListener("error", bail("got error event"));
|
||||
|
||||
v.src = test.name;
|
||||
v.play();
|
||||
}
|
||||
|
||||
function beginTest() {
|
||||
manager.runTests(gEMETests, startTest);
|
||||
}
|
||||
|
||||
var prefs = [ ];
|
||||
|
||||
if (/Linux/.test(navigator.userAgent) ||
|
||||
!document.createElement('video').canPlayType("video/mp4")) {
|
||||
// XXX remove once we have mp4 PlatformDecoderModules on all platforms.
|
||||
prefs.push([ "media.fragmented-mp4.exposed", true ]);
|
||||
prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({ "set" : prefs }, beginTest);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -211,14 +211,6 @@ const kEventConstructors = {
|
|||
return new KeyboardEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
MediaEncryptedEvent: { create: function (aName, aProps) {
|
||||
return new MediaEncryptedEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
MediaKeyMessageEvent: { create: function (aName, aProps) {
|
||||
return new MediaKeyMessageEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
MediaStreamEvent: { create: function (aName, aProps) {
|
||||
return new MediaStreamEvent(aName, aProps);
|
||||
},
|
||||
|
|
|
@ -254,7 +254,5 @@ user_pref("loop.throttled", false);
|
|||
user_pref("browser.uitour.pinnedTabUrl", "http://%(server)s/uitour-dummy/pinnedTab");
|
||||
user_pref("browser.uitour.url", "http://%(server)s/uitour-dummy/tour");
|
||||
|
||||
user_pref("media.eme.enabled", true);
|
||||
|
||||
// Don't prompt about e10s
|
||||
user_pref("browser.displayedE10SPrompt", 5);
|
||||
|
|
Загрузка…
Ссылка в новой задаче