2009-07-10 02:03:01 +00:00
|
|
|
// In each list of tests below, test file types that are not supported should
|
|
|
|
// be ignored. To make sure tests respect that, we include a file of type
|
|
|
|
// "bogus/duh" in each list.
|
|
|
|
|
2009-10-05 04:04:07 +00:00
|
|
|
// These are small test files, good for just seeing if something loads. We
|
|
|
|
// really only need one test file per backend here.
|
2009-07-10 02:03:01 +00:00
|
|
|
var gSmallTests = [
|
2012-01-19 18:30:29 +00:00
|
|
|
{ name:"small-shot.ogg", type:"audio/ogg", duration:0.276 },
|
2012-12-18 08:38:37 +00:00
|
|
|
{ name:"small-shot.m4a", type:"audio/mp4", duration:0.29 },
|
|
|
|
{ name:"small-shot.mp3", type:"audio/mpeg", duration:0.27 },
|
2014-08-12 11:54:04 +00:00
|
|
|
{ name:"small-shot-mp3.mp4", type:"audio/mp4; codecs=mp3", duration:0.34 },
|
2009-07-10 02:03:01 +00:00
|
|
|
{ name:"r11025_s16_c1.wav", type:"audio/x-wav", duration:1.0 },
|
2012-08-03 03:22:24 +00:00
|
|
|
{ name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.266 },
|
2012-05-11 08:32:15 +00:00
|
|
|
{ name:"seek.webm", type:"video/webm", width:320, height:240, duration:3.966 },
|
2013-12-19 15:02:00 +00:00
|
|
|
{ name:"vp9.webm", type:"video/webm", width:320, height:240, duration:4 },
|
2012-05-02 00:29:42 +00:00
|
|
|
{ name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 },
|
2014-12-19 00:25:00 +00:00
|
|
|
{ name:"gizmo.mp4", type:"video/mp4", width:560, height:320, duration:5.56 },
|
2010-05-30 22:02:06 +00:00
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
|
|
|
];
|
|
|
|
|
2014-06-05 21:22:15 +00:00
|
|
|
if (SpecialPowers.Services.appinfo.name != "B2G") {
|
|
|
|
// We only run mochitests on b2g desktop and b2g emulator. The 3gp codecs
|
|
|
|
// aren't present on desktop, and the emulator codecs (which are different
|
|
|
|
// from the real device codecs) don't pass all of our tests, so we need
|
|
|
|
// to disable them.
|
|
|
|
|
|
|
|
gSmallTests = gSmallTests.concat([
|
|
|
|
{ name:"sample.3gp", type:"video/3gpp", duration:4.933 },
|
|
|
|
{ name:"sample.3g2", type:"video/3gpp2", duration:4.933 }
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2013-06-11 15:23:13 +00:00
|
|
|
// Used by test_bug654550.html, for videoStats preference
|
|
|
|
var gVideoTests = [
|
|
|
|
{ name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.266 },
|
|
|
|
{ name:"seek.webm", type:"video/webm", width:320, height:240, duration:3.966 },
|
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
|
|
|
];
|
|
|
|
|
2010-05-30 22:02:06 +00:00
|
|
|
// Used by test_progress to ensure we get the correct progress information
|
|
|
|
// during resource download.
|
|
|
|
var gProgressTests = [
|
|
|
|
{ name:"r11025_u8_c1.wav", type:"audio/x-wav", duration:1.0, size:11069 },
|
2012-03-18 23:36:06 +00:00
|
|
|
{ name:"big.wav", type:"audio/x-wav", duration:9.278981, size:102444 },
|
2010-05-30 22:02:06 +00:00
|
|
|
{ name:"seek.ogv", type:"video/ogg", duration:3.966, size:285310 },
|
2012-08-03 03:22:24 +00:00
|
|
|
{ name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.266, size:28942 },
|
2010-07-20 01:29:28 +00:00
|
|
|
{ name:"seek.webm", type:"video/webm", duration:3.966, size:215529 },
|
2012-10-19 07:09:09 +00:00
|
|
|
{ name:"gizmo.mp4", type:"video/mp4", duration:5.56, size:383631 },
|
2009-09-01 22:33:43 +00:00
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
2009-07-10 02:03:01 +00:00
|
|
|
];
|
2009-07-10 02:03:01 +00:00
|
|
|
|
2012-05-01 00:29:29 +00:00
|
|
|
// Used by test_played.html
|
|
|
|
var gPlayedTests = [
|
|
|
|
{ name:"big.wav", type:"audio/x-wav", duration:9.0 },
|
|
|
|
{ name:"seek.ogv", type:"video/ogg", duration:3.966 },
|
|
|
|
{ name:"seek.webm", type:"video/webm", duration:3.966 },
|
2012-10-19 07:09:09 +00:00
|
|
|
{ name:"gizmo.mp4", type:"video/mp4", duration:5.56 },
|
2012-12-18 08:38:37 +00:00
|
|
|
{ name:"owl.mp3", type:"audio/mpeg", duration:3.29 },
|
2015-01-11 19:02:00 +00:00
|
|
|
// Disable vbr.mp3 to see if it reduces the error of AUDCLNT_E_CPUUSAGE_EXCEEDED.
|
|
|
|
// See bug 1110922 comment 26.
|
|
|
|
//{ name:"vbr.mp3", type:"audio/mpeg", duration:10.0 },
|
2014-04-10 08:37:07 +00:00
|
|
|
{ name:"bug495794.ogg", type:"audio/ogg", duration:0.3 }
|
2012-05-01 00:29:29 +00:00
|
|
|
];
|
|
|
|
|
2009-10-15 02:59:41 +00:00
|
|
|
// Used by test_mozLoadFrom. Need one test file per decoder backend, plus
|
|
|
|
// anything for testing clone-specific bugs.
|
2011-11-25 02:06:22 +00:00
|
|
|
var cloneKey = Math.floor(Math.random()*100000000);
|
2009-10-15 02:59:41 +00:00
|
|
|
var gCloneTests = gSmallTests.concat([
|
2010-01-27 12:29:26 +00:00
|
|
|
// Actual duration is ~200ms, we have Content-Duration lie about it.
|
2009-10-15 02:59:41 +00:00
|
|
|
{ name:"bug520908.ogv", type:"video/ogg", duration:9000 },
|
2011-11-25 02:06:22 +00:00
|
|
|
// short-video is more like 1s, so if you load this twice you'll get an unexpected duration
|
|
|
|
{ name:"dynamic_resource.sjs?key=" + cloneKey + "&res1=320x240.ogv&res2=short-video.ogv",
|
2012-08-03 03:22:24 +00:00
|
|
|
type:"video/ogg", duration:0.266 },
|
2009-10-15 02:59:41 +00:00
|
|
|
]);
|
|
|
|
|
2010-01-08 04:55:39 +00:00
|
|
|
// Used by test_play_twice. Need one test file per decoder backend, plus
|
|
|
|
// anything for testing bugs that occur when replying a played file.
|
|
|
|
var gReplayTests = gSmallTests.concat([
|
|
|
|
{ name:"bug533822.ogg", type:"audio/ogg" },
|
|
|
|
]);
|
|
|
|
|
2010-05-30 22:02:06 +00:00
|
|
|
// Used by test_paused_after_ended. Need one test file per decoder backend, plus
|
|
|
|
// anything for testing bugs that occur when replying a played file.
|
|
|
|
var gPausedAfterEndedTests = gSmallTests.concat([
|
|
|
|
{ name:"r11025_u8_c1.wav", type:"audio/x-wav", duration:1.0 },
|
|
|
|
{ name:"small-shot.ogg", type:"video/ogg", duration:0.276 }
|
|
|
|
]);
|
|
|
|
|
2013-04-17 05:18:53 +00:00
|
|
|
// Test the mozHasAudio property, and APIs that detect different kinds of
|
|
|
|
// tracks
|
|
|
|
var gTrackTests = [
|
|
|
|
{ name:"big.wav", type:"audio/x-wav", duration:9.278981, size:102444, hasAudio:true, hasVideo:false },
|
|
|
|
{ name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.266, size:28942, hasAudio:false, hasVideo:true },
|
|
|
|
{ name:"short-video.ogv", type:"video/ogg", duration:1.081, hasAudio:true, hasVideo:true },
|
|
|
|
{ name:"seek.webm", type:"video/webm", duration:3.966, size:215529, hasAudio:false, hasVideo:true },
|
2012-04-28 15:01:10 +00:00
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
|
|
|
];
|
|
|
|
|
2013-07-22 01:37:42 +00:00
|
|
|
// Used by any media recorder test. Need one test file per decoder backend
|
|
|
|
// currently supported by the media encoder.
|
|
|
|
var gMediaRecorderTests = [
|
|
|
|
{ name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 }
|
|
|
|
];
|
|
|
|
|
2009-10-05 04:04:07 +00:00
|
|
|
// These are files that we want to make sure we can play through. We can
|
2009-10-04 22:54:13 +00:00
|
|
|
// also check metadata. Put files of the same type together in this list so if
|
|
|
|
// something crashes we have some idea of which backend is responsible.
|
2009-10-05 04:04:07 +00:00
|
|
|
// Used by test_playback, which expects no error event and one ended event.
|
2009-07-10 02:03:01 +00:00
|
|
|
var gPlayTests = [
|
2009-07-10 02:03:02 +00:00
|
|
|
// 8-bit samples
|
|
|
|
{ name:"r11025_u8_c1.wav", type:"audio/x-wav", duration:1.0 },
|
|
|
|
// 8-bit samples, file is truncated
|
2009-07-10 02:03:01 +00:00
|
|
|
{ name:"r11025_u8_c1_trunc.wav", type:"audio/x-wav", duration:1.8 },
|
|
|
|
// file has trailing non-PCM data
|
|
|
|
{ name:"r11025_s16_c1_trailing.wav", type:"audio/x-wav", duration:1.0 },
|
|
|
|
// file with list chunk
|
|
|
|
{ name:"r16000_u8_c1_list.wav", type:"audio/x-wav", duration:4.2 },
|
2009-10-05 04:04:07 +00:00
|
|
|
|
2010-05-13 00:59:42 +00:00
|
|
|
// Ogg stream without eof marker
|
2010-05-30 22:02:06 +00:00
|
|
|
{ name:"bug461281.ogg", type:"application/ogg", duration:2.208 },
|
2010-05-13 00:59:42 +00:00
|
|
|
|
2009-07-10 02:03:01 +00:00
|
|
|
// oggz-chop stream
|
2010-04-02 03:03:07 +00:00
|
|
|
{ name:"bug482461.ogv", type:"video/ogg", duration:4.34 },
|
2011-02-18 02:30:33 +00:00
|
|
|
// Theora only oggz-chop stream
|
|
|
|
{ name:"bug482461-theora.ogv", type:"video/ogg", duration:4.138 },
|
2009-08-04 06:13:40 +00:00
|
|
|
// With first frame a "duplicate" (empty) frame.
|
|
|
|
{ name:"bug500311.ogv", type:"video/ogg", duration:1.96 },
|
2009-08-04 05:20:37 +00:00
|
|
|
// Small audio file
|
2014-10-27 22:34:00 +00:00
|
|
|
{ name:"small-shot.ogg", type:"audio/ogg", duration:0.276 },
|
2009-08-16 21:32:24 +00:00
|
|
|
// More audio in file than video.
|
2009-09-07 03:25:22 +00:00
|
|
|
{ name:"short-video.ogv", type:"video/ogg", duration:1.081 },
|
2009-09-15 05:53:49 +00:00
|
|
|
// First Theora data packet is zero bytes.
|
2010-05-30 22:02:06 +00:00
|
|
|
{ name:"bug504613.ogv", type:"video/ogg", duration:Number.NaN },
|
2009-09-29 00:59:00 +00:00
|
|
|
// Multiple audio streams.
|
2010-04-02 03:03:07 +00:00
|
|
|
{ name:"bug516323.ogv", type:"video/ogg", duration:4.208 },
|
2011-03-24 01:16:30 +00:00
|
|
|
// oggz-chop with non-keyframe as first frame
|
|
|
|
{ name:"bug556821.ogv", type:"video/ogg", duration:2.551 },
|
2010-04-02 03:03:07 +00:00
|
|
|
|
2009-10-04 22:54:13 +00:00
|
|
|
// Encoded with vorbis beta1, includes unusually sized codebooks
|
2010-04-02 03:03:07 +00:00
|
|
|
{ name:"beta-phrasebook.ogg", type:"audio/ogg", duration:4.01 },
|
2009-10-14 03:35:59 +00:00
|
|
|
// Small file, only 1 frame with audio only.
|
|
|
|
{ name:"bug520493.ogg", type:"audio/ogg", duration:0.458 },
|
2009-10-14 03:36:01 +00:00
|
|
|
// Small file with vorbis comments with 0 length values and names.
|
|
|
|
{ name:"bug520500.ogg", type:"audio/ogg", duration:0.123 },
|
|
|
|
|
2009-10-05 04:04:07 +00:00
|
|
|
// Various weirdly formed Ogg files
|
|
|
|
{ name:"bug499519.ogv", type:"video/ogg", duration:0.24 },
|
|
|
|
{ name:"bug506094.ogv", type:"video/ogg", duration:0 },
|
2010-04-02 03:03:07 +00:00
|
|
|
{ name:"bug498855-1.ogv", type:"video/ogg", duration:0.24 },
|
|
|
|
{ name:"bug498855-2.ogv", type:"video/ogg", duration:0.24 },
|
|
|
|
{ name:"bug498855-3.ogv", type:"video/ogg", duration:0.24 },
|
|
|
|
{ name:"bug504644.ogv", type:"video/ogg", duration:1.6 },
|
2009-10-05 04:04:07 +00:00
|
|
|
{ name:"chain.ogv", type:"video/ogg", duration:Number.NaN },
|
2010-04-02 03:03:07 +00:00
|
|
|
{ name:"bug523816.ogv", type:"video/ogg", duration:0.533 },
|
|
|
|
{ name:"bug495129.ogv", type:"video/ogg", duration:2.41 },
|
2010-05-30 22:02:06 +00:00
|
|
|
{ name:"bug498380.ogv", type:"video/ogg", duration:0.533 },
|
2010-04-08 08:16:02 +00:00
|
|
|
{ name:"bug495794.ogg", type:"audio/ogg", duration:0.3 },
|
|
|
|
{ name:"bug557094.ogv", type:"video/ogg", duration:0.24 },
|
2011-08-04 20:44:24 +00:00
|
|
|
{ name:"multiple-bos.ogg", type:"video/ogg", duration:0.431 },
|
2010-04-08 08:16:02 +00:00
|
|
|
{ name:"audio-overhang.ogg", type:"audio/ogg", duration:2.3 },
|
|
|
|
{ name:"video-overhang.ogg", type:"audio/ogg", duration:3.966 },
|
2009-10-05 04:04:07 +00:00
|
|
|
|
2010-08-13 02:28:15 +00:00
|
|
|
// bug461281.ogg with the middle second chopped out.
|
|
|
|
{ name:"audio-gaps.ogg", type:"audio/ogg", duration:2.208 },
|
|
|
|
|
2010-04-22 00:32:52 +00:00
|
|
|
// Test playback/metadata work after a redirect
|
2010-05-30 22:02:06 +00:00
|
|
|
{ name:"redirect.sjs?domain=mochi.test:8888&file=320x240.ogv",
|
2012-08-03 03:22:24 +00:00
|
|
|
type:"video/ogg", duration:0.266 },
|
2010-04-22 00:32:52 +00:00
|
|
|
|
2010-06-08 23:31:27 +00:00
|
|
|
// Test playback of a webm file
|
|
|
|
{ name:"seek.webm", type:"video/webm", duration:3.966 },
|
|
|
|
|
2010-10-06 22:58:36 +00:00
|
|
|
// Test playback of a WebM file with non-zero start time.
|
|
|
|
{ name:"split.webm", type:"video/webm", duration:1.967 },
|
2013-01-24 12:38:32 +00:00
|
|
|
|
2010-07-26 19:35:16 +00:00
|
|
|
// Test playback of a raw file
|
|
|
|
{ name:"seek.yuv", type:"video/x-raw-yuv", duration:1.833 },
|
2013-01-24 12:38:32 +00:00
|
|
|
|
2010-12-19 19:05:40 +00:00
|
|
|
// A really short, low sample rate, single channel file. This tests whether
|
|
|
|
// we can handle playing files when only push very little audio data to the
|
|
|
|
// hardware.
|
|
|
|
{ name:"spacestorm-1000Hz-100ms.ogg", type:"audio/ogg", duration:0.099 },
|
2010-07-26 19:35:16 +00:00
|
|
|
|
2012-05-02 00:29:42 +00:00
|
|
|
// Opus data in an ogg container
|
|
|
|
{ name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 },
|
2013-12-16 18:48:00 +00:00
|
|
|
// Opus data in a webm container
|
|
|
|
{ name:"detodos.webm", type:"audio/webm; codecs=opus", duration:2.9135 },
|
2014-09-19 01:01:26 +00:00
|
|
|
{ name:"bug1066943.webm", type:"audio/webm; codecs=opus", duration:1.383 },
|
2012-05-02 00:29:42 +00:00
|
|
|
|
2013-05-01 21:15:57 +00:00
|
|
|
// Multichannel Opus in an ogg container
|
|
|
|
{ name:"test-1-mono.opus", type:"audio/ogg; codecs=opus", duration:1.044 },
|
|
|
|
{ name:"test-2-stereo.opus", type:"audio/ogg; codecs=opus", duration:2.925 },
|
|
|
|
{ name:"test-3-LCR.opus", type:"audio/ogg; codecs=opus", duration:4.214 },
|
|
|
|
{ name:"test-4-quad.opus", type:"audio/ogg; codecs=opus", duration:6.234 },
|
|
|
|
{ name:"test-5-5.0.opus", type:"audio/ogg; codecs=opus", duration:7.558 },
|
|
|
|
{ name:"test-6-5.1.opus", type:"audio/ogg; codecs=opus", duration:10.333 },
|
|
|
|
{ name:"test-7-6.1.opus", type:"audio/ogg; codecs=opus", duration:11.690 },
|
|
|
|
{ name:"test-8-7.1.opus", type:"audio/ogg; codecs=opus", duration:13.478 },
|
|
|
|
|
2012-10-19 07:09:09 +00:00
|
|
|
{ name:"gizmo.mp4", type:"video/mp4", duration:5.56 },
|
2012-08-10 08:15:20 +00:00
|
|
|
|
2012-12-18 08:38:37 +00:00
|
|
|
{ name:"small-shot.m4a", type:"audio/mp4", duration:0.29 },
|
|
|
|
{ name:"small-shot.mp3", type:"audio/mpeg", duration:0.27 },
|
|
|
|
{ name:"owl.mp3", type:"audio/mpeg", duration:3.29 },
|
2013-08-28 22:53:03 +00:00
|
|
|
// owl.mp3 as above, but with something funny going on in the ID3v2 tag
|
|
|
|
// that causes DirectShow to fail.
|
|
|
|
{ name:"owl-funny-id3.mp3", type:"audio/mpeg", duration:3.29 },
|
2013-09-08 21:47:54 +00:00
|
|
|
// owl.mp3 as above, but with something even funnier going on in the ID3v2 tag
|
|
|
|
// that causes DirectShow to fail.
|
|
|
|
{ name:"owl-funnier-id3.mp3", type:"audio/mpeg", duration:3.29 },
|
2013-12-02 21:25:28 +00:00
|
|
|
// One second of silence with ~140KB of ID3 tags. Usually when the first MP3
|
|
|
|
// frame is at such a high offset into the file, MP3FrameParser will give up
|
|
|
|
// and report that the stream is not MP3. However, it does not count ID3 tags
|
|
|
|
// in that offset. This test case makes sure that ID3 exclusion holds.
|
|
|
|
{ name:"huge-id3.mp3", type:"audio/mpeg", duration:1.00 },
|
|
|
|
// A truncated VBR MP3 with just enough frames to keep most decoders happy.
|
|
|
|
// The Xing header reports the length of the file to be around 10 seconds, but
|
|
|
|
// there is really only one second worth of data. We want MP3FrameParser to
|
|
|
|
// trust the header, so this should be reported as 10 seconds.
|
|
|
|
{ name:"vbr-head.mp3", type:"audio/mpeg", duration:10.00 },
|
2012-12-18 08:38:37 +00:00
|
|
|
|
2012-05-02 00:29:42 +00:00
|
|
|
// Invalid file
|
2014-12-22 18:43:00 +00:00
|
|
|
{ name:"bogus.duh", type:"bogus/duh", duration:Number.NaN },
|
|
|
|
|
|
|
|
// Test playback of a WebM file with vp9 video
|
|
|
|
//{ name:"vp9.webm", type:"video/webm", duration:4 },
|
|
|
|
{ name:"vp9cake.webm", type:"video/webm", duration:7.966 }
|
2010-05-30 22:02:06 +00:00
|
|
|
];
|
|
|
|
|
2012-09-04 23:24:34 +00:00
|
|
|
// A file for each type we can support.
|
|
|
|
var gSnifferTests = [
|
|
|
|
{ name:"big.wav", type:"audio/x-wav", duration:9.278981, size:102444 },
|
|
|
|
{ name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.233, size:28942 },
|
|
|
|
{ name:"seek.webm", type:"video/webm", duration:3.966, size:215529 },
|
2012-12-18 08:38:37 +00:00
|
|
|
{ name:"gizmo.mp4", type:"video/mp4", duration:5.56, size:383631 },
|
2012-09-04 23:24:34 +00:00
|
|
|
// A mp3 file with id3 tags.
|
|
|
|
{ name:"id3tags.mp3", type:"audio/mpeg", duration:0.28, size:3530},
|
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
|
|
|
];
|
|
|
|
|
2012-11-19 23:13:43 +00:00
|
|
|
// Files we must reject as invalid.
|
|
|
|
var gInvalidTests = [
|
|
|
|
{ name:"invalid-m0c0.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-m0c3.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-m1c0.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-m1c9.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-m2c0.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-m2c1.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-cmap-short.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-cmap-s0c0.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-cmap-s0c2.opus", type:"audio/ogg; codecs=opus"},
|
|
|
|
{ name:"invalid-cmap-s1c2.opus", type:"audio/ogg; codecs=opus"},
|
2014-02-03 03:39:00 +00:00
|
|
|
{ name:"invalid-preskip.webm", type:"audio/webm; codecs=opus"},
|
2012-11-19 23:13:43 +00:00
|
|
|
];
|
|
|
|
|
2014-09-30 01:14:41 +00:00
|
|
|
var gInvalidPlayTests = [
|
|
|
|
{ name:"invalid-excess_discard.webm", type:"audio/webm; codecs=opus"},
|
|
|
|
{ name:"invalid-excess_neg_discard.webm", type:"audio/webm; codecs=opus"},
|
|
|
|
{ name:"invalid-neg_discard.webm", type:"audio/webm; codecs=opus"},
|
|
|
|
{ name:"invalid-discard_on_multi_blocks.webm", type:"audio/webm; codecs=opus"},
|
|
|
|
];
|
|
|
|
|
2014-08-26 06:33:08 +00:00
|
|
|
// Files to check different cases of ogg skeleton information.
|
|
|
|
// sample-fisbone-skeleton4.ogv
|
|
|
|
// - Skeleton v4, w/ Content-Type,Role,Name,Language,Title for both theora/vorbis
|
|
|
|
// sample-fisbone-wrong-header.ogv
|
|
|
|
// - Skeleton v4, wrong message field sequence for vorbis
|
|
|
|
// multiple-bos-more-header-fields.ogg
|
|
|
|
// - Skeleton v3, w/ Content-Type,Role,Name,Language,Title for both theora/vorbis
|
|
|
|
// seek.ogv
|
|
|
|
// - No skeleton, but theora
|
|
|
|
// audio-overhang.ogg
|
|
|
|
// - No skeleton, but vorbis
|
|
|
|
var gMultitrackInfoOggPlayList = [
|
|
|
|
{ name:"sample-fisbone-skeleton4.ogv", type:"video/ogg", duration:5.049 },
|
|
|
|
{ name:"sample-fisbone-wrong-header.ogv", type:"video/ogg", duration:5.049 },
|
|
|
|
{ name:"multiple-bos-more-header-fileds.ogg", type:"video/ogg", duration:0.431 },
|
|
|
|
{ name:"seek.ogv", type:"video/ogg", duration:3.996 },
|
|
|
|
{ name:"audio-gaps.ogg", type:"audio/ogg", duration:2.208 }
|
|
|
|
];
|
|
|
|
// Pre-parsed results of gMultitrackInfoOggPlayList.
|
|
|
|
var gOggTrackInfoResults = {
|
|
|
|
"sample-fisbone-skeleton4.ogv" : {
|
|
|
|
"audio_id":" audio_1",
|
|
|
|
"audio_kind":"main",
|
|
|
|
"audio_language":" en-US",
|
|
|
|
"audio_label":" Audio track for test",
|
|
|
|
"video_id":" video_1",
|
|
|
|
"video_kind":"main",
|
|
|
|
"video_language":" fr",
|
|
|
|
"video_label":" Video track for test"
|
|
|
|
},
|
|
|
|
"sample-fisbone-wrong-header.ogv" : {
|
|
|
|
"audio_id":"1",
|
|
|
|
"audio_kind":"main",
|
|
|
|
"audio_language":"",
|
|
|
|
"audio_label":"",
|
|
|
|
"video_id":" video_1",
|
|
|
|
"video_kind":"main",
|
|
|
|
"video_language":" fr",
|
|
|
|
"video_label":" Video track for test"
|
|
|
|
},
|
|
|
|
"multiple-bos-more-header-fileds.ogg" : {
|
|
|
|
"audio_id":"1",
|
|
|
|
"audio_kind":"main",
|
|
|
|
"audio_language":"",
|
|
|
|
"audio_label":"",
|
|
|
|
"video_id":"2",
|
|
|
|
"video_kind":"main",
|
|
|
|
"video_language":"",
|
|
|
|
"video_label":""
|
|
|
|
},
|
|
|
|
"seek.ogv" : {
|
|
|
|
"video_id":"2",
|
|
|
|
"video_kind":"main",
|
|
|
|
"video_language":"",
|
|
|
|
"video_label":""
|
|
|
|
},
|
|
|
|
"audio-gaps.ogg" : {
|
|
|
|
"audio_id":"1",
|
|
|
|
"audio_kind":"main",
|
|
|
|
"audio_language":"",
|
|
|
|
"audio_label":""
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-05-30 22:02:06 +00:00
|
|
|
// Converts a path/filename to a file:// URI which we can load from disk.
|
|
|
|
// Optionally checks whether the file actually exists on disk at the location
|
|
|
|
// we've specified.
|
|
|
|
function fileUriToSrc(path, mustExist) {
|
2012-06-10 23:44:50 +00:00
|
|
|
// android mochitest doesn't support file://
|
2013-07-25 20:32:17 +00:00
|
|
|
if (navigator.appVersion.indexOf("Android") != -1 || SpecialPowers.Services.appinfo.name == "B2G")
|
2012-06-10 23:44:50 +00:00
|
|
|
return path;
|
|
|
|
|
2012-09-24 12:46:29 +00:00
|
|
|
const Ci = SpecialPowers.Ci;
|
|
|
|
const Cc = SpecialPowers.Cc;
|
|
|
|
const Cr = SpecialPowers.Cr;
|
2010-05-30 22:02:06 +00:00
|
|
|
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
|
|
|
getService(Ci.nsIProperties);
|
|
|
|
var f = dirSvc.get("CurWorkD", Ci.nsILocalFile);
|
|
|
|
var split = path.split("/");
|
|
|
|
for(var i = 0; i < split.length; ++i) {
|
|
|
|
f.append(split[i]);
|
|
|
|
}
|
|
|
|
if (mustExist && !f.exists()) {
|
|
|
|
ok(false, "We expected '" + path + "' to exist, but it doesn't!");
|
|
|
|
}
|
|
|
|
return f.path;
|
|
|
|
}
|
|
|
|
|
2013-03-02 19:14:44 +00:00
|
|
|
// Returns true if two TimeRanges are equal, false otherwise
|
2011-08-09 10:10:48 +00:00
|
|
|
function range_equals(r1, r2) {
|
|
|
|
if (r1.length != r2.length) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (var i = 0; i < r1.length; i++) {
|
|
|
|
if (r1.start(i) != r2.start(i) || r1.end(i) != r2.end(i)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-05-30 22:02:06 +00:00
|
|
|
// These are URIs to files that we use to check that we don't leak any state
|
|
|
|
// or other information such that script can determine stuff about a user's
|
|
|
|
// environment. Used by test_info_leak.
|
|
|
|
var gInfoLeakTests = [
|
|
|
|
{
|
|
|
|
type: 'video/ogg',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: fileUriToSrc("tests/dom/media/test/320x240.ogv", true),
|
2010-05-30 22:02:06 +00:00
|
|
|
},{
|
|
|
|
type: 'video/ogg',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: fileUriToSrc("tests/dom/media/test/404.ogv", false),
|
2010-05-30 22:02:06 +00:00
|
|
|
}, {
|
|
|
|
type: 'audio/x-wav',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: fileUriToSrc("tests/dom/media/test/r11025_s16_c1.wav", true),
|
2010-05-30 22:02:06 +00:00
|
|
|
}, {
|
|
|
|
type: 'audio/x-wav',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: fileUriToSrc("tests/dom/media/test/404.wav", false),
|
2010-05-30 22:02:06 +00:00
|
|
|
}, {
|
|
|
|
type: 'audio/ogg',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: fileUriToSrc("tests/dom/media/test/bug461281.ogg", true),
|
2010-05-30 22:02:06 +00:00
|
|
|
}, {
|
|
|
|
type: 'audio/ogg',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: fileUriToSrc("tests/dom/media/test/404.ogg", false),
|
2010-07-20 01:29:28 +00:00
|
|
|
}, {
|
|
|
|
type: 'video/webm',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: fileUriToSrc("tests/dom/media/test/seek.webm", true),
|
2010-07-20 01:29:28 +00:00
|
|
|
}, {
|
|
|
|
type: 'video/webm',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: fileUriToSrc("tests/dom/media/test/404.webm", false),
|
2010-05-30 22:02:06 +00:00
|
|
|
}, {
|
|
|
|
type: 'video/ogg',
|
|
|
|
src: 'http://localhost/404.ogv',
|
|
|
|
}, {
|
|
|
|
type: 'audio/x-wav',
|
|
|
|
src: 'http://localhost/404.wav',
|
2010-07-20 01:29:28 +00:00
|
|
|
}, {
|
|
|
|
type: 'video/webm',
|
|
|
|
src: 'http://localhost/404.webm',
|
2010-05-30 22:02:06 +00:00
|
|
|
}, {
|
|
|
|
type: 'video/ogg',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: 'http://example.com/tests/dom/media/test/test_info_leak.html'
|
2010-05-30 22:02:06 +00:00
|
|
|
}, {
|
|
|
|
type: 'audio/ogg',
|
2014-10-25 17:24:36 +00:00
|
|
|
src: 'http://example.com/tests/dom/media/test/test_info_leak.html'
|
2010-05-30 22:02:06 +00:00
|
|
|
}
|
2009-07-10 02:03:01 +00:00
|
|
|
];
|
|
|
|
|
2009-10-04 22:54:13 +00:00
|
|
|
// These are files that must fire an error during load or playback, and do not
|
|
|
|
// cause a crash. Put files of the same type together in this list so if
|
|
|
|
// something crashes we have some idea of which backend is responsible. Used
|
|
|
|
// by test_playback_errors, which expects one error event and no ended event.
|
2009-07-10 02:03:01 +00:00
|
|
|
// Put files of the same type together in this list so if something crashes
|
|
|
|
// we have some idea of which backend is responsible.
|
|
|
|
var gErrorTests = [
|
|
|
|
{ name:"bogus.wav", type:"audio/x-wav" },
|
|
|
|
{ name:"bogus.ogv", type:"video/ogg" },
|
2009-08-04 02:44:45 +00:00
|
|
|
{ name:"448636.ogv", type:"video/ogg" },
|
2010-04-02 03:03:07 +00:00
|
|
|
{ name:"bug504843.ogv", type:"video/ogg" },
|
|
|
|
{ name:"bug501279.ogg", type:"audio/ogg" },
|
2010-08-05 03:49:27 +00:00
|
|
|
{ name:"bug580982.webm", type:"video/webm" },
|
2010-10-16 19:57:45 +00:00
|
|
|
{ name:"bug603918.webm", type:"video/webm" },
|
|
|
|
{ name:"bug604067.webm", type:"video/webm" },
|
2009-07-10 02:03:01 +00:00
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
|
|
|
];
|
|
|
|
|
2009-07-10 02:03:02 +00:00
|
|
|
// These are files that have nontrivial duration and are useful for seeking within.
|
|
|
|
var gSeekTests = [
|
|
|
|
{ name:"r11025_s16_c1.wav", type:"audio/x-wav", duration:1.0 },
|
2011-04-13 22:12:23 +00:00
|
|
|
{ name:"audio.wav", type:"audio/x-wav", duration:0.031247 },
|
2009-07-10 02:03:02 +00:00
|
|
|
{ name:"seek.ogv", type:"video/ogg", duration:3.966 },
|
2012-08-03 03:22:24 +00:00
|
|
|
{ name:"320x240.ogv", type:"video/ogg", duration:0.266 },
|
2010-07-20 01:29:28 +00:00
|
|
|
{ name:"seek.webm", type:"video/webm", duration:3.966 },
|
2014-12-01 22:59:45 +00:00
|
|
|
{ name:"sine.webm", type:"audio/webm", duration:4.001 },
|
2014-02-26 00:36:54 +00:00
|
|
|
{ name:"bug516323.indexed.ogv", type:"video/ogg", duration:4.208333 },
|
2010-10-06 22:58:36 +00:00
|
|
|
{ name:"split.webm", type:"video/webm", duration:1.967 },
|
2012-05-02 00:29:42 +00:00
|
|
|
{ name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 },
|
2012-12-18 08:38:37 +00:00
|
|
|
{ name:"gizmo.mp4", type:"video/mp4", duration:5.56 },
|
|
|
|
{ name:"owl.mp3", type:"audio/mpeg", duration:3.29 },
|
2009-07-10 02:03:02 +00:00
|
|
|
{ name:"bogus.duh", type:"bogus/duh", duration:123 }
|
|
|
|
];
|
|
|
|
|
2014-04-01 03:39:04 +00:00
|
|
|
var gFastSeekTests = [
|
|
|
|
{ name:"gizmo.mp4", type:"video/mp4", keyframes:[0, 1.0, 2.0, 3.0, 4.0, 5.0 ] },
|
|
|
|
// Note: Not all keyframes in the file are actually referenced in the Cues in this file.
|
|
|
|
{ name:"seek.webm", type:"video/webm", keyframes:[0, 0.8, 1.6, 2.4, 3.2]},
|
2014-04-03 21:39:15 +00:00
|
|
|
// Note: the sync points are the points on both the audio and video streams
|
|
|
|
// before the keyframes. You can't just assume that the keyframes are the sync
|
|
|
|
// points, as the audio required for that sync point may be before the keyframe.
|
|
|
|
{ name:"bug516323.indexed.ogv", type:"video/ogg", keyframes:[0, 0.46, 3.06] },
|
2014-04-01 03:39:04 +00:00
|
|
|
];
|
|
|
|
|
2013-06-12 22:15:23 +00:00
|
|
|
function IsWindows8OrLater() {
|
|
|
|
var re = /Windows NT (\d.\d)/;
|
|
|
|
var winver = navigator.userAgent.match(re);
|
|
|
|
return winver && winver.length == 2 && parseFloat(winver[1]) >= 6.2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// These are files that are non seekable, due to problems with the media,
|
|
|
|
// for example broken or missing indexes.
|
|
|
|
var gUnseekableTests = [
|
|
|
|
{ name:"no-cues.webm", type:"video/webm" },
|
|
|
|
{ name:"bogus.duh", type:"bogus/duh"}
|
|
|
|
];
|
2014-01-22 15:50:23 +00:00
|
|
|
// Android supports fragmented MP4 playback from 4.3.
|
|
|
|
var androidVersion = SpecialPowers.Cc['@mozilla.org/system-info;1']
|
|
|
|
.getService(SpecialPowers.Ci.nsIPropertyBag2)
|
|
|
|
.getProperty('version');
|
|
|
|
// Fragmented MP4.
|
|
|
|
if (navigator.userAgent.indexOf("Mobile") != -1 && androidVersion >= 18) {
|
|
|
|
gUnseekableTests = gUnseekableTests.concat([
|
|
|
|
{ name:"street.mp4", type:"video/mp4" }
|
|
|
|
]);
|
|
|
|
}
|
2013-06-12 22:15:23 +00:00
|
|
|
|
2009-07-10 02:03:02 +00:00
|
|
|
// These are files suitable for using with a "new Audio" constructor.
|
|
|
|
var gAudioTests = [
|
|
|
|
{ name:"r11025_s16_c1.wav", type:"audio/x-wav", duration:1.0 },
|
|
|
|
{ name:"sound.ogg", type:"audio/ogg" },
|
2012-12-18 08:38:37 +00:00
|
|
|
{ name:"owl.mp3", type:"audio/mpeg", duration:3.29 },
|
|
|
|
{ name:"small-shot.m4a", type:"audio/mp4", duration:0.29 },
|
2009-07-10 02:03:02 +00:00
|
|
|
{ name:"bogus.duh", type:"bogus/duh", duration:123 }
|
|
|
|
];
|
|
|
|
|
2010-09-10 02:48:36 +00:00
|
|
|
// These files ensure our handling of 404 errors is consistent across the
|
2010-05-30 22:02:06 +00:00
|
|
|
// various backends.
|
|
|
|
var g404Tests = [
|
|
|
|
{ name:"404.wav", type:"audio/x-wav" },
|
|
|
|
{ name:"404.ogv", type:"video/ogg" },
|
|
|
|
{ name:"404.oga", type:"audio/ogg" },
|
|
|
|
{ name:"404.webm", type:"video/webm" },
|
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
|
|
|
];
|
|
|
|
|
2009-09-22 00:08:13 +00:00
|
|
|
// These are files suitable for testing various decoder failures that are
|
|
|
|
// expected to fire MEDIA_ERR_DECODE. Used by test_decode_error, which expects
|
|
|
|
// an error and emptied event, and no loadedmetadata or ended event.
|
|
|
|
var gDecodeErrorTests = [
|
|
|
|
// Valid files with unsupported codecs
|
|
|
|
{ name:"r11025_msadpcm_c1.wav", type:"audio/x-wav" },
|
|
|
|
{ name:"dirac.ogg", type:"video/ogg" },
|
|
|
|
// Invalid files
|
|
|
|
{ name:"bogus.wav", type:"audio/x-wav" },
|
|
|
|
{ name:"bogus.ogv", type:"video/ogg" },
|
|
|
|
|
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
|
|
|
];
|
|
|
|
|
2011-08-24 23:42:27 +00:00
|
|
|
// These are files that are used for media fragments tests
|
|
|
|
var gFragmentTests = [
|
2012-03-18 23:36:06 +00:00
|
|
|
{ name:"big.wav", type:"audio/x-wav", duration:9.278981, size:102444 }
|
2011-08-24 23:42:27 +00:00
|
|
|
];
|
|
|
|
|
2012-11-30 13:17:55 +00:00
|
|
|
// Used by test_chaining.html. The |links| attributes is the number of links in
|
|
|
|
// this file that we should be able to play.
|
|
|
|
var gChainingTests = [
|
|
|
|
// Vorbis and Opus chained file. They have user comments |index=n| where `n`
|
|
|
|
// is the index of this segment in the file, 0 indexed.
|
|
|
|
{ name:"chain.ogg", type:"audio/ogg", links: 4},
|
|
|
|
{ name:"chain.opus", type:"audio/ogg; codec=opus", links: 4},
|
|
|
|
// Those files are chained files with a different number of channels in each
|
|
|
|
// part. This is not supported and should stop playing after the first part.
|
|
|
|
{ name:"variable-channel.ogg", type:"audio/ogg", links: 1 },
|
|
|
|
{ name:"variable-channel.opus", type:"audio/ogg; codec=opus", links: 1 },
|
|
|
|
// Those files are chained files with a different sample rate in each
|
|
|
|
// part. This is not supported and should stop playing after the first part.
|
|
|
|
{ name:"variable-samplerate.ogg", type:"audio/ogg", links: 1 },
|
|
|
|
// Opus decoding in Firefox outputs 48 kHz PCM despite having a different
|
|
|
|
// original sample rate, so we can safely play Opus chained media that have
|
|
|
|
// different samplerate accross links.
|
|
|
|
{ name:"variable-samplerate.opus", type:"audio/ogg; codec=opus", links: 2 },
|
|
|
|
// A chained video file. We don't support those, so only one link should be
|
|
|
|
// reported.
|
|
|
|
{ name:"chained-video.ogv", type:"video/ogg", links: 1 },
|
|
|
|
// A file that consist in 4 links of audio, then another link that has video.
|
|
|
|
// We should stop right after the 4 audio links.
|
|
|
|
{ name:"chained-audio-video.ogg", type:"video/ogg", links: 4 },
|
2012-12-03 14:44:26 +00:00
|
|
|
// An opus file that has two links, with a different preskip value for each
|
|
|
|
// link. We should be able to play both links.
|
|
|
|
{ name:"variable-preskip.opus", type:"audio/ogg; codec=opus", links: 2 },
|
2012-11-30 13:17:55 +00:00
|
|
|
{ name:"bogus.duh", type:"bogus/duh" }
|
|
|
|
];
|
2011-08-24 23:42:27 +00:00
|
|
|
|
2013-11-18 05:26:51 +00:00
|
|
|
// Videos with an aspect ratio. Used for testing that displaying frames
|
|
|
|
// on a canvas works correctly in the case of non-standard aspect ratios.
|
|
|
|
// See bug 874897 for an example.
|
|
|
|
var gAspectRatioTests = [
|
|
|
|
{ name:"VID_0001.ogg", type:"video/ogg", duration:19.966 }
|
|
|
|
];
|
|
|
|
|
2012-07-31 00:14:29 +00:00
|
|
|
// These are files with non-trivial tag sets.
|
|
|
|
// Used by test_metadata.html.
|
|
|
|
var gMetadataTests = [
|
|
|
|
// Ogg Vorbis files
|
|
|
|
{ name:"short-video.ogv", tags: {
|
|
|
|
TITLE:"Lepidoptera",
|
|
|
|
ARTIST:"Epoq",
|
|
|
|
ALBUM:"Kahvi Collective",
|
|
|
|
DATE:"2002",
|
|
|
|
COMMENT:"http://www.kahvi.org",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ name:"bug516323.ogv", tags: {
|
|
|
|
GENRE:"Open Movie",
|
|
|
|
ENCODER:"Audacity",
|
|
|
|
TITLE:"Elephants Dream",
|
|
|
|
ARTIST:"Silvia Pfeiffer",
|
|
|
|
COMMENTS:"Audio Description"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ name:"bug516323.indexed.ogv", tags: {
|
|
|
|
GENRE:"Open Movie",
|
|
|
|
ENCODER:"Audacity",
|
|
|
|
TITLE:"Elephants Dream",
|
|
|
|
ARTIST:"Silvia Pfeiffer",
|
|
|
|
COMMENTS:"Audio Description"
|
|
|
|
}
|
|
|
|
},
|
2012-09-17 22:42:36 +00:00
|
|
|
{ name:"detodos.opus", tags: {
|
|
|
|
title:"De todos. Para todos.",
|
|
|
|
artist:"Mozilla.org"
|
|
|
|
}
|
|
|
|
},
|
2012-09-10 22:39:23 +00:00
|
|
|
{ name:"sound.ogg", tags: { } },
|
2012-09-21 20:13:41 +00:00
|
|
|
{ name:"small-shot.ogg", tags: {
|
|
|
|
title:"Pew SFX"
|
|
|
|
}
|
|
|
|
},
|
2012-09-10 22:39:23 +00:00
|
|
|
{ name:"badtags.ogg", tags: {
|
|
|
|
// We list only the valid tags here, and verify
|
|
|
|
// the invalid ones are filtered out.
|
|
|
|
title:"Invalid comments test file",
|
|
|
|
empty:"",
|
|
|
|
"":"empty",
|
|
|
|
"{- [(`!@\"#$%^&')] -}":"valid tag name, surprisingly"
|
|
|
|
// The file also includes the following invalid tags.
|
|
|
|
// "A description with no separator is a common problem.",
|
|
|
|
// "雨":"Likely, but an invalid key (non-ascii).",
|
|
|
|
// "not\nval\x1fid":"invalid tag name",
|
|
|
|
// "not~valid":"this isn't a valid name either",
|
|
|
|
// "not-utf-8":"invalid sequences: \xff\xfe\xfa\xfb\0eol"
|
|
|
|
}
|
2012-10-06 11:32:30 +00:00
|
|
|
},
|
|
|
|
{ name:"wave_metadata.wav", tags: {
|
|
|
|
name:"Track Title",
|
|
|
|
artist:"Artist Name",
|
|
|
|
comments:"Comments",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ name:"wave_metadata_utf8.wav", tags: {
|
|
|
|
name:"歌曲名稱",
|
|
|
|
artist:"作曲者",
|
|
|
|
comments:"註解",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ name:"wave_metadata_unknown_tag.wav", tags: {
|
|
|
|
name:"Track Title",
|
|
|
|
comments:"Comments",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ name:"wave_metadata_bad_len.wav", tags: {
|
|
|
|
name:"Track Title",
|
|
|
|
artist:"Artist Name",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ name:"wave_metadata_bad_no_null.wav", tags: {
|
|
|
|
name:"Track Title",
|
|
|
|
artist:"Artist Name",
|
|
|
|
comments:"Comments!!",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ name:"wave_metadata_bad_utf8.wav", tags: {
|
|
|
|
name:"歌曲名稱",
|
|
|
|
comments:"註解",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ name:"wavedata_u8.wav", tags: { }
|
|
|
|
},
|
2012-07-31 00:14:29 +00:00
|
|
|
];
|
|
|
|
|
2014-09-24 03:59:11 +00:00
|
|
|
// Test files for Encrypted Media Extensions
|
|
|
|
var gEMETests = [
|
|
|
|
{
|
|
|
|
name:"short-cenc.mp4",
|
2014-10-13 22:05:00 +00:00
|
|
|
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
|
2014-09-24 03:59:11 +00:00
|
|
|
keys: {
|
|
|
|
// "keyid" : "key"
|
|
|
|
"7e571d017e571d017e571d017e571d01" : "7e5711117e5711117e5711117e571111",
|
|
|
|
"7e571d027e571d027e571d027e571d02" : "7e5722227e5722227e5722227e572222",
|
|
|
|
},
|
|
|
|
sessionType:"temporary",
|
2014-10-13 22:05:00 +00:00
|
|
|
duration:0.47
|
|
|
|
},
|
2015-01-29 07:30:38 +00:00
|
|
|
{
|
|
|
|
name:"short-cenc.mp4",
|
|
|
|
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
|
|
|
|
keys: {
|
|
|
|
// "keyid" : "key"
|
|
|
|
"7e571d017e571d017e571d017e571d01" : "7e5711117e5711117e5711117e571111",
|
|
|
|
"7e571d027e571d027e571d027e571d02" : "7e5722227e5722227e5722227e572222",
|
|
|
|
},
|
|
|
|
sessionType:"temporary",
|
|
|
|
duration:0.47,
|
|
|
|
crossOrigin:true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name:"gizmo-frag-cencinit.mp4",
|
|
|
|
fragments: [ "gizmo-frag-cencinit.mp4", "gizmo-frag-cenc1.m4s", "gizmo-frag-cenc2.m4s" ],
|
|
|
|
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
|
|
|
|
keys: {
|
|
|
|
// "keyid" : "key"
|
|
|
|
"7e571d037e571d037e571d037e571d03" : "7e5733337e5733337e5733337e573333",
|
|
|
|
"7e571d047e571d047e571d047e571d04" : "7e5744447e5744447e5744447e574444",
|
|
|
|
},
|
|
|
|
sessionType:"temporary",
|
|
|
|
duration:2.00,
|
|
|
|
},
|
2014-10-15 01:17:03 +00:00
|
|
|
{
|
|
|
|
name:"gizmo-frag-cencinit.mp4",
|
|
|
|
fragments: [ "gizmo-frag-cencinit.mp4", "gizmo-frag-cenc1.m4s", "gizmo-frag-cenc2.m4s" ],
|
|
|
|
type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"",
|
|
|
|
keys: {
|
|
|
|
// "keyid" : "key"
|
|
|
|
"7e571d037e571d037e571d037e571d03" : "7e5733337e5733337e5733337e573333",
|
|
|
|
"7e571d047e571d047e571d047e571d04" : "7e5744447e5744447e5744447e574444",
|
|
|
|
},
|
|
|
|
sessionType:"temporary",
|
|
|
|
duration:2.00,
|
2015-01-29 07:30:38 +00:00
|
|
|
crossOrigin:true,
|
2014-10-15 01:17:03 +00:00
|
|
|
},
|
2014-09-24 03:59:11 +00:00
|
|
|
];
|
|
|
|
|
2009-07-10 02:03:01 +00:00
|
|
|
function checkMetadata(msg, e, test) {
|
|
|
|
if (test.width) {
|
|
|
|
is(e.videoWidth, test.width, msg + " video width");
|
|
|
|
}
|
|
|
|
if (test.height) {
|
|
|
|
is(e.videoHeight, test.height, msg + " video height");
|
|
|
|
}
|
|
|
|
if (test.duration) {
|
|
|
|
ok(Math.abs(e.duration - test.duration) < 0.1,
|
2010-05-30 22:02:06 +00:00
|
|
|
msg + " duration (" + e.duration + ") should be around " + test.duration);
|
2009-07-10 02:03:01 +00:00
|
|
|
}
|
2015-01-27 06:10:11 +00:00
|
|
|
is(!!test.keys, SpecialPowers.do_lookupGetter(e, "isEncrypted").apply(e),
|
|
|
|
msg + " isEncrypted should be true if we have decryption keys");
|
2009-07-10 02:03:01 +00:00
|
|
|
}
|
2010-05-30 22:02:06 +00:00
|
|
|
|
|
|
|
// Returns the first test from candidates array which we can play with the
|
|
|
|
// installed video backends.
|
|
|
|
function getPlayableVideo(candidates) {
|
2014-10-27 22:34:00 +00:00
|
|
|
var resources = getPlayableVideos(candidates);
|
2010-05-30 22:02:06 +00:00
|
|
|
if (resources.length > 0)
|
|
|
|
return resources[0];
|
|
|
|
return null;
|
|
|
|
}
|
2010-08-27 02:11:46 +00:00
|
|
|
|
2014-10-27 22:34:00 +00:00
|
|
|
function getPlayableVideos(candidates) {
|
|
|
|
var v = document.createElement("video");
|
|
|
|
return candidates.filter(function(x){return /^video/.test(x.type) && v.canPlayType(x.type);});
|
|
|
|
}
|
|
|
|
|
2012-01-19 18:30:29 +00:00
|
|
|
function getPlayableAudio(candidates) {
|
|
|
|
var v = document.createElement("audio");
|
|
|
|
var resources = candidates.filter(function(x){return /^audio/.test(x.type) && v.canPlayType(x.type);});
|
|
|
|
if (resources.length > 0)
|
|
|
|
return resources[0];
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-01-23 19:24:41 +00:00
|
|
|
// Returns the type of element that should be created for the given mimetype.
|
|
|
|
function getMajorMimeType(mimetype) {
|
2013-04-03 00:05:00 +00:00
|
|
|
if (/^video/.test(mimetype)) {
|
2013-01-23 19:24:41 +00:00
|
|
|
return "video";
|
|
|
|
} else {
|
|
|
|
return "audio";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-14 21:29:00 +00:00
|
|
|
// Force releasing decoder to avoid timeout in waiting for decoding resource.
|
2014-01-17 05:58:48 +00:00
|
|
|
function removeNodeAndSource(n) {
|
|
|
|
n.remove();
|
2014-09-14 21:29:00 +00:00
|
|
|
// reset |mozSrcObject| first since it takes precedence over |src|.
|
|
|
|
n.mozSrcObject = null;
|
2014-01-17 05:58:48 +00:00
|
|
|
n.src = "";
|
|
|
|
while (n.firstChild) {
|
|
|
|
n.removeChild(n.firstChild);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-01 22:59:45 +00:00
|
|
|
// Number of tests to run in parallel.
|
2010-08-27 02:11:46 +00:00
|
|
|
var PARALLEL_TESTS = 2;
|
|
|
|
|
2011-01-13 01:06:16 +00:00
|
|
|
// When true, we'll loop forever on whatever test we run. Use this to debug
|
|
|
|
// intermittent test failures.
|
|
|
|
const DEBUG_TEST_LOOP_FOREVER = false;
|
|
|
|
|
2010-08-27 02:11:46 +00:00
|
|
|
// Manages a run of media tests. Runs them in chunks in order to limit
|
|
|
|
// the number of media elements/threads running in parallel. This limits peak
|
|
|
|
// memory use, particularly on Linux x86 where thread stacks use 10MB of
|
|
|
|
// virtual address space.
|
|
|
|
// Usage:
|
|
|
|
// 1. Create a new MediaTestManager object.
|
|
|
|
// 2. Create a test startTest function. This takes a test object and a token,
|
|
|
|
// and performs anything necessary to start the test. The test object is an
|
2013-01-24 12:38:32 +00:00
|
|
|
// element in one of the g*Tests above. Your startTest function must call
|
2010-08-27 02:11:46 +00:00
|
|
|
// MediaTestManager.start(token) if it starts a test. The test object is
|
|
|
|
// guaranteed to be playable by our supported decoders; you don't need to
|
|
|
|
// check canPlayType.
|
|
|
|
// 3. When your tests finishes, call MediaTestManager.finished(), passing
|
|
|
|
// the token back to the manager. The manager may either start the next run
|
|
|
|
// or end the mochitest if all the tests are done.
|
|
|
|
function MediaTestManager() {
|
|
|
|
|
|
|
|
// Sets up a MediaTestManager to runs through the 'tests' array, which needs
|
|
|
|
// to be one of, or have the same fields as, the g*Test arrays of tests. Uses
|
2013-01-24 12:38:32 +00:00
|
|
|
// the user supplied 'startTest' function to initialize the test. This
|
2010-08-27 02:11:46 +00:00
|
|
|
// function must accept two arguments, the test entry from the 'tests' array,
|
|
|
|
// and a token. Call MediaTestManager.started(token) if you start the test,
|
|
|
|
// and MediaTestManager.finished(token) when the test finishes. You don't have
|
|
|
|
// to start every test, but if you call started() you *must* call finish()
|
2013-01-24 12:38:32 +00:00
|
|
|
// else you'll timeout.
|
2010-08-27 02:11:46 +00:00
|
|
|
this.runTests = function(tests, startTest) {
|
2011-08-31 03:38:10 +00:00
|
|
|
this.startTime = new Date();
|
|
|
|
SimpleTest.info("Started " + this.startTime + " (" + this.startTime.getTime()/1000 + "s)");
|
2010-08-27 02:11:46 +00:00
|
|
|
this.testNum = 0;
|
|
|
|
this.tests = tests;
|
|
|
|
this.startTest = startTest;
|
|
|
|
this.tokens = [];
|
2011-08-31 03:38:10 +00:00
|
|
|
this.isShutdown = false;
|
2011-11-28 23:17:09 +00:00
|
|
|
this.numTestsRunning = 0;
|
2010-08-27 02:11:46 +00:00
|
|
|
// Always wait for explicit finish.
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2013-05-21 14:48:09 +00:00
|
|
|
this.nextTest();
|
2010-08-27 02:11:46 +00:00
|
|
|
}
|
2013-01-24 12:38:32 +00:00
|
|
|
|
2010-08-27 02:11:46 +00:00
|
|
|
// Registers that the test corresponding to 'token' has been started.
|
|
|
|
// Don't call more than once per token.
|
|
|
|
this.started = function(token) {
|
|
|
|
this.tokens.push(token);
|
2011-11-28 23:17:09 +00:00
|
|
|
this.numTestsRunning++;
|
2011-11-29 22:01:14 +00:00
|
|
|
is(this.numTestsRunning, this.tokens.length, "[started " + token + "] Length of array should match number of running tests");
|
2010-08-27 02:11:46 +00:00
|
|
|
}
|
2013-01-24 12:38:32 +00:00
|
|
|
|
2014-06-18 05:07:02 +00:00
|
|
|
this.watchdog = null;
|
|
|
|
|
|
|
|
this.watchdogFn = function() {
|
|
|
|
if (this.tokens.length > 0) {
|
|
|
|
info("Watchdog remaining tests= " + this.tokens);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-27 02:11:46 +00:00
|
|
|
// Registers that the test corresponding to 'token' has finished. Call when
|
|
|
|
// you've finished your test. If all tests are complete this will finish the
|
|
|
|
// run, otherwise it may start up the next run. It's ok to call multiple times
|
|
|
|
// per token.
|
|
|
|
this.finished = function(token) {
|
|
|
|
var i = this.tokens.indexOf(token);
|
|
|
|
if (i != -1) {
|
|
|
|
// Remove the element from the list of running tests.
|
|
|
|
this.tokens.splice(i, 1);
|
|
|
|
}
|
2014-06-18 05:07:02 +00:00
|
|
|
|
|
|
|
if (this.watchdog) {
|
|
|
|
clearTimeout(this.watchdog);
|
|
|
|
this.watchdog = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
info("[finished " + token + "] remaining= " + this.tokens);
|
2011-11-28 23:17:09 +00:00
|
|
|
this.numTestsRunning--;
|
2011-11-29 22:01:14 +00:00
|
|
|
is(this.numTestsRunning, this.tokens.length, "[finished " + token + "] Length of array should match number of running tests");
|
2011-08-31 03:38:10 +00:00
|
|
|
if (this.tokens.length < PARALLEL_TESTS) {
|
2010-08-27 02:11:46 +00:00
|
|
|
this.nextTest();
|
2014-06-18 05:07:02 +00:00
|
|
|
this.watchdog = setTimeout(this.watchdogFn.bind(this), 10000);
|
2010-08-27 02:11:46 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-28 23:17:09 +00:00
|
|
|
|
2010-08-27 02:11:46 +00:00
|
|
|
// Starts the next batch of tests, or finishes if they're all done.
|
|
|
|
// Don't call this directly, call finished(token) when you're done.
|
|
|
|
this.nextTest = function() {
|
2014-09-14 21:29:00 +00:00
|
|
|
while (this.testNum < this.tests.length && this.tokens.length < PARALLEL_TESTS) {
|
|
|
|
var test = this.tests[this.testNum];
|
|
|
|
var token = (test.name ? (test.name + "-"): "") + this.testNum;
|
|
|
|
this.testNum++;
|
|
|
|
|
|
|
|
if (DEBUG_TEST_LOOP_FOREVER && this.testNum == this.tests.length) {
|
|
|
|
this.testNum = 0;
|
2011-01-13 01:06:16 +00:00
|
|
|
}
|
2013-01-24 12:38:32 +00:00
|
|
|
|
2014-09-14 21:29:00 +00:00
|
|
|
// Ensure we can play the resource type.
|
|
|
|
if (test.type && !document.createElement('video').canPlayType(test.type))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Do the init. This should start the test.
|
|
|
|
this.startTest(test, token);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.testNum == this.tests.length &&
|
|
|
|
!DEBUG_TEST_LOOP_FOREVER &&
|
|
|
|
this.tokens.length == 0 &&
|
|
|
|
!this.isShutdown)
|
|
|
|
{
|
|
|
|
this.isShutdown = true;
|
|
|
|
if (this.onFinished) {
|
|
|
|
this.onFinished();
|
2011-08-31 03:38:10 +00:00
|
|
|
}
|
2014-10-01 22:36:00 +00:00
|
|
|
var onCleanup = function() {
|
|
|
|
var end = new Date();
|
|
|
|
SimpleTest.info("Finished at " + end + " (" + (end.getTime() / 1000) + "s)");
|
|
|
|
SimpleTest.info("Running time: " + (end.getTime() - this.startTime.getTime())/1000 + "s");
|
|
|
|
SimpleTest.finish();
|
|
|
|
}.bind(this);
|
|
|
|
mediaTestCleanup(onCleanup);
|
2014-09-14 21:29:00 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-08-27 02:11:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensures we've got no active video or audio elements in the document, and
|
|
|
|
// forces a GC to release the address space reserved by the decoders' threads'
|
|
|
|
// stacks.
|
2014-10-01 22:36:00 +00:00
|
|
|
function mediaTestCleanup(callback) {
|
2010-08-27 02:11:46 +00:00
|
|
|
var V = document.getElementsByTagName("video");
|
|
|
|
for (i=0; i<V.length; i++) {
|
2014-01-17 05:58:48 +00:00
|
|
|
removeNodeAndSource(V[i]);
|
2010-08-27 02:11:46 +00:00
|
|
|
V[i] = null;
|
|
|
|
}
|
|
|
|
var A = document.getElementsByTagName("audio");
|
|
|
|
for (i=0; i<A.length; i++) {
|
2014-01-17 05:58:48 +00:00
|
|
|
removeNodeAndSource(A[i]);
|
2010-08-27 02:11:46 +00:00
|
|
|
A[i] = null;
|
|
|
|
}
|
2014-10-01 22:36:00 +00:00
|
|
|
var cb = function() {
|
|
|
|
if (callback) {
|
|
|
|
callback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SpecialPowers.exactGC(window, cb);
|
2010-08-27 02:11:46 +00:00
|
|
|
}
|
2013-05-21 14:48:09 +00:00
|
|
|
|
|
|
|
(function() {
|
2014-12-11 18:34:40 +00:00
|
|
|
SimpleTest.requestFlakyTimeout("untriaged");
|
|
|
|
|
2013-05-21 14:48:09 +00:00
|
|
|
// Ensure that preload preferences are comsistent
|
|
|
|
var prefService = SpecialPowers.wrap(SpecialPowers.Components)
|
|
|
|
.classes["@mozilla.org/preferences-service;1"]
|
|
|
|
.getService(SpecialPowers.Ci.nsIPrefService);
|
|
|
|
var branch = prefService.getBranch("media.");
|
|
|
|
var oldDefault = 2;
|
|
|
|
var oldAuto = 3;
|
2013-09-14 01:14:42 +00:00
|
|
|
var oldAppleMedia = undefined;
|
2013-06-21 23:16:53 +00:00
|
|
|
var oldGStreamer = undefined;
|
2013-05-21 14:48:09 +00:00
|
|
|
var oldOpus = undefined;
|
2013-06-21 23:16:53 +00:00
|
|
|
|
2013-09-14 01:14:42 +00:00
|
|
|
try { oldAppleMedia = SpecialPowers.getBoolPref("media.apple.mp3.enabled"); } catch(ex) { }
|
2013-07-25 20:32:17 +00:00
|
|
|
try { oldGStreamer = SpecialPowers.getBoolPref("media.gstreamer.enabled"); } catch(ex) { }
|
|
|
|
try { oldDefault = SpecialPowers.getIntPref("media.preload.default"); } catch(ex) { }
|
|
|
|
try { oldAuto = SpecialPowers.getIntPref("media.preload.auto"); } catch(ex) { }
|
|
|
|
try { oldOpus = SpecialPowers.getBoolPref("media.opus.enabled"); } catch(ex) { }
|
2013-06-21 23:16:53 +00:00
|
|
|
|
2013-07-25 20:32:17 +00:00
|
|
|
SpecialPowers.setIntPref("media.preload.default", 2); // preload_metadata
|
|
|
|
SpecialPowers.setIntPref("media.preload.auto", 3); // preload_enough
|
2013-05-21 14:48:09 +00:00
|
|
|
// test opus playback iff the pref exists
|
|
|
|
if (oldOpus !== undefined)
|
2013-07-25 20:32:17 +00:00
|
|
|
SpecialPowers.setBoolPref("media.opus.enabled", true);
|
2013-06-21 23:16:53 +00:00
|
|
|
if (oldGStreamer !== undefined)
|
2013-07-25 20:32:17 +00:00
|
|
|
SpecialPowers.setBoolPref("media.gstreamer.enabled", true);
|
2013-09-14 01:14:42 +00:00
|
|
|
if (oldAppleMedia !== undefined)
|
|
|
|
SpecialPowers.setBoolPref("media.apple.mp3.enabled", true);
|
2013-05-21 14:48:09 +00:00
|
|
|
|
|
|
|
window.addEventListener("unload", function() {
|
2013-06-21 23:16:53 +00:00
|
|
|
if (oldGStreamer !== undefined)
|
2013-07-25 20:32:17 +00:00
|
|
|
SpecialPowers.setBoolPref("media.gstreamer.enabled", oldGStreamer);
|
2013-09-14 01:14:42 +00:00
|
|
|
if (oldAppleMedia !== undefined)
|
|
|
|
SpecialPowers.setBoolPref("media.apple.mp3.enabled", oldAppleMedia);
|
2013-07-25 20:32:17 +00:00
|
|
|
SpecialPowers.setIntPref("media.preload.default", oldDefault);
|
|
|
|
SpecialPowers.setIntPref("media.preload.auto", oldAuto);
|
2013-05-21 14:48:09 +00:00
|
|
|
if (oldOpus !== undefined)
|
2013-07-25 20:32:17 +00:00
|
|
|
SpecialPowers.setBoolPref("media.opus.enabled", oldOpus);
|
2013-05-21 14:48:09 +00:00
|
|
|
}, false);
|
|
|
|
})();
|