Bug 1207019 - Make EME mochitests specify mime types for video in MediaKeys request videoTypes, ditto for audio. r=gerald

This commit is contained in:
Chris Pearce 2015-10-05 15:03:58 +13:00
Родитель d4ed7efef9
Коммит a7e012482a
5 изменённых файлов: 31 добавлений и 26 удалений

Просмотреть файл

@ -332,6 +332,11 @@ function SetupEME(test, token, params)
}); });
} }
function streamType(type) {
var x = test.tracks.find(o => o.name == type);
return x ? x.type : undefined;
}
// All 'initDataType's should be the same. // All 'initDataType's should be the same.
// null indicates no 'encrypted' event received yet. // null indicates no 'encrypted' event received yet.
var initDataType = null; var initDataType = null;
@ -353,8 +358,8 @@ function SetupEME(test, token, params)
var options = [ var options = [
{ {
initDataType: ev.initDataType, initDataType: ev.initDataType,
videoType: test.type, videoType: streamType("video"),
audioType: test.type, audioType: streamType("audio"),
} }
]; ];
var p = navigator.requestMediaKeySystemAccess(KEYSYSTEM_TYPE, options); var p = navigator.requestMediaKeySystemAccess(KEYSYSTEM_TYPE, options);

Просмотреть файл

@ -792,7 +792,6 @@ var gEMETests = [
}, },
{ {
name:"400x300 audio&video tracks, each with its key", name:"400x300 audio&video tracks, each with its key",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -824,7 +823,6 @@ var gEMETests = [
}, },
{ {
name:"640x480@624kbps audio&video tracks, each with its key", name:"640x480@624kbps audio&video tracks, each with its key",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -856,7 +854,6 @@ var gEMETests = [
}, },
{ {
name:"640x480@959kbps audio&video tracks, each with its key", name:"640x480@959kbps audio&video tracks, each with its key",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -888,7 +885,6 @@ var gEMETests = [
}, },
{ {
name:"640x480 then 400x300, same key (1st) per track", name:"640x480 then 400x300, same key (1st) per track",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -921,7 +917,6 @@ var gEMETests = [
}, },
{ {
name:"640x480 then 400x300, same key (2nd) per track", name:"640x480 then 400x300, same key (2nd) per track",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -954,7 +949,6 @@ var gEMETests = [
}, },
{ {
name:"640x480 with 1st keys then 400x300 with 2nd keys", name:"640x480 with 1st keys then 400x300 with 2nd keys",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -988,7 +982,6 @@ var gEMETests = [
}, },
{ {
name:"400x300 with 1st keys then 640x480 with 2nd keys", name:"400x300 with 1st keys then 640x480 with 2nd keys",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1022,7 +1015,6 @@ var gEMETests = [
}, },
{ {
name:"640x480@959kbps with 1st keys then 640x480@624kbps with 2nd keys", name:"640x480@959kbps with 1st keys then 640x480@624kbps with 2nd keys",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1056,7 +1048,6 @@ var gEMETests = [
}, },
{ {
name:"640x480@624kbps with 1st keys then 640x480@959kbps with 2nd keys", name:"640x480@624kbps with 1st keys then 640x480@959kbps with 2nd keys",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1090,7 +1081,6 @@ var gEMETests = [
}, },
{ {
name:"400x300 with presentation size 533x300", name:"400x300 with presentation size 533x300",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1122,7 +1112,6 @@ var gEMETests = [
}, },
{ {
name:"400x300 as-is then 400x300 presented as 533x300", name:"400x300 as-is then 400x300 presented as 533x300",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1156,7 +1145,6 @@ var gEMETests = [
}, },
{ {
name:"400x225", name:"400x225",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1187,7 +1175,6 @@ var gEMETests = [
}, },
{ {
name:"640x360", name:"640x360",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1218,7 +1205,6 @@ var gEMETests = [
}, },
{ {
name:"400x225 then 640x360", name:"400x225 then 640x360",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1252,7 +1238,6 @@ var gEMETests = [
}, },
{ {
name:"640x360 then 640x480", name:"640x360 then 640x480",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
tracks: [ tracks: [
{ {
name:"audio", name:"audio",
@ -1289,7 +1274,8 @@ var gEMETests = [
var gEMENonMSEFailTests = [ var gEMENonMSEFailTests = [
{ {
name:"short-cenc.mp4", name:"short-cenc.mp4",
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"", audioType:"audio/mp4; codecs=\"mp4a.40.2\"",
videoType:"video/mp4; codecs=\"avc1.64000d\"",
duration:0.47, duration:0.47,
}, },
]; ];

Просмотреть файл

@ -69,6 +69,8 @@ function check_mp4(v, enabled) {
check("audio/x-m4a; codecs=\"mp4a.40.2\"", "probably"); check("audio/x-m4a; codecs=\"mp4a.40.2\"", "probably");
check("audio/x-m4a; codecs=mp4a.40.2", "probably"); check("audio/x-m4a; codecs=mp4a.40.2", "probably");
check("audio/mp4; codecs=\"mp4a.40.2,\"", ""); // Invalid codecs string
// HE-AAC v1 // HE-AAC v1
check("audio/mp4; codecs=\"mp4a.40.5\"", "probably"); check("audio/mp4; codecs=\"mp4a.40.5\"", "probably");
check("audio/mp4; codecs=mp4a.40.5", "probably"); check("audio/mp4; codecs=mp4a.40.5", "probably");

Просмотреть файл

@ -12,11 +12,12 @@
<script class="testbody" type="text/javascript"> <script class="testbody" type="text/javascript">
var manager = new MediaTestManager; var manager = new MediaTestManager;
function DoSetMediaKeys(v) function DoSetMediaKeys(v, test)
{ {
var options = [{ var options = [{
initDataType: "cenc", initDataType: "cenc",
videoType: test.type, audioType: test.audioType,
videoType: test.videoType,
}]; }];
return navigator.requestMediaKeySystemAccess("org.w3.clearkey", options) return navigator.requestMediaKeySystemAccess("org.w3.clearkey", options)
@ -68,7 +69,7 @@ function TestSetSrc(test, token)
manager.finished(token); manager.finished(token);
}); });
DoSetMediaKeys(v) DoSetMediaKeys(v, test)
.then(function() { .then(function() {
v.src = test.name; v.src = test.name;

Просмотреть файл

@ -202,12 +202,23 @@ var tests = [
shouldPass: false, shouldPass: false,
}, },
{ {
name: 'MP4 video container with mp3 and h264 is unsupported', name: 'MP4 video container type with an audio codec is unsupported',
keySystem: CLEARKEY_ID, keySystem: CLEARKEY_ID,
options: [ options: [
{ {
initDataType: 'cenc', initDataType: 'cenc',
videoType: 'video/mp4; codecs="avc1.42E01E,mp3"', videoType: 'video/mp4; codecs="mp3"',
}
],
shouldPass: false,
},
{
name: 'MP4 audio container type with a video codec is unsupported',
keySystem: CLEARKEY_ID,
options: [
{
initDataType: 'cenc',
audioType: 'audio/mp4; codecs="avc1.42E01E"',
} }
], ],
shouldPass: false, shouldPass: false,
@ -218,7 +229,7 @@ var tests = [
options: [ options: [
{ {
initDataType: 'cenc', initDataType: 'cenc',
audioType: 'video/mp4; codecs="avc1.42E01E"', videoType: 'video/mp4; codecs="avc1.42E01E"',
} }
], ],
shouldPass: true, shouldPass: true,
@ -235,7 +246,7 @@ var tests = [
shouldPass: false, shouldPass: false,
}, },
{ {
name: 'MP4 video container with constrained baseline h.264 and AAC-LC', name: 'MP4 video container with both audio and video codec type in videoType',
keySystem: CLEARKEY_ID, keySystem: CLEARKEY_ID,
options: [ options: [
{ {
@ -243,7 +254,7 @@ var tests = [
videoType: 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"', videoType: 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"',
} }
], ],
shouldPass: true, shouldPass: false,
}, },
{ {
name: 'MP4 audio and video type both specified', name: 'MP4 audio and video type both specified',