1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
<!DOCTYPE HTML>
<html>
<head>
<title>Test video software decoding</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/**
* This test verifies that software video decoding is correctly executed on the
* appropriate process and utilizes the correct decoder across various platforms.
*/
// TODO : as on Android we still don't have RDD process, add Android test cases
// later in bug 1974849.
const gTestCases = [
{
codec : "H264",
files: ["gizmo.mp4"],
platforms : {
WINNT : {
decoder : "wmf H264 codec software video decoder",
process : "RDD",
},
Darwin : {
decoder: "apple software VT decoder",
process : "RDD",
},
Linux : {
decoder: "ffmpeg video decoder",
process : "RDD",
},
}
},
{
codec : "VP8",
files: ["bipbop_short_vp8.webm"],
platforms : {
WINNT : {
decoder : "ffvpx video decoder",
process : "RDD",
},
Darwin : {
decoder: "ffvpx video decoder",
process : "RDD",
},
Linux : {
decoder: "ffvpx video decoder",
process : "RDD",
},
}
},
{
codec : "VP9",
files: ["gizmo.webm"],
platforms : {
WINNT : {
decoder : "ffvpx video decoder",
process : "RDD",
},
Darwin : {
decoder: "ffvpx video decoder",
process : "RDD",
},
Linux : {
decoder: "ffvpx video decoder",
process : "RDD",
},
}
},
{
codec : "AV1",
files: [
"av1.mp4",
"gizmo_av1_8bit_420.webm",
"gizmo_av1_10bit_420.webm",
],
platforms : {
WINNT : {
decoder : "ffvpx video decoder",
process : "RDD",
},
Darwin : {
decoder: "ffvpx video decoder",
process : "RDD",
},
Linux : {
decoder: "ffvpx video decoder",
process : "RDD",
},
}
},
{
// HEVC SW decoder is added since MacOS 10.13, and since ffmpeg 2.0.2.
codec : "HEVC",
files: [
"gizmo_hevc_8bit_420.mp4",
"gizmo_hevc_10bit_420.mp4",
],
platforms : {
// Our MacOS 10.15 workers on the try server somehow do not support
// HEVC SW, but MacOS 15 does. We may consider enabling this when
// all workers have HEVC SW support in the future.
// Darwin : {
// decoder: "apple software VT decoder",
// process : "RDD",
// },
Linux : {
decoder: "ffmpeg video decoder",
process : "RDD",
},
}
},
];
add_task(async function testSoftwareVideoDecoding() {
const platformName = SpecialPowers.Services.appinfo.OS;
for (let {codec, files, platforms} of gTestCases) {
let platformData = platforms[platformName];
if (platformData === undefined) {
ok(true, `skip ${codec} test on ${platformName}`);
continue;
}
info(`run ${codec} SW test on ${platformName}`);
for (let file of files) {
await createAndPlayVideo(file);
await assertRunningProcessAndDecoderName({
expectedProcess: platformData.process,
expectedDecoder: platformData.decoder,
});
}
}
});
// Following are helper functions
async function createAndPlayVideo(fileUrl) {
let video = document.querySelector("video");
if (!video) {
video = document.createElement("video");
document.body.appendChild(video);
}
video.src = fileUrl;
video.loop = true;
ok(
await video.play().then(
() => true,
() => false
),
"video started playing"
);
}
async function assertRunningProcessAndDecoderName(
{ expectedProcess, expectedDecoder } = {}
) {
const video = document.querySelector("video");
ok(!video.paused, "checking a playing video that should be sw decoding");
const debugInfo = await SpecialPowers.wrap(video).mozRequestDebugInfo();
const videoDecoderName = debugInfo.decoder.reader.videoDecoderName;
is(debugInfo.decoder.reader.videoHardwareAccelerated, false,
`decoder should not be hardware accelerated`);
const isExpectedDecoder =
videoDecoderName.indexOf(`${expectedDecoder}`) == 0;
ok(
isExpectedDecoder,
`Playback running by decoder '${videoDecoderName}', expected '${expectedDecoder}'`
);
const isExpectedProcess =
videoDecoderName.indexOf(`(${expectedProcess} remote)`) > 0;
ok(
isExpectedProcess,
`Playback running in process '${videoDecoderName}', expected '${expectedProcess}'`
);
}
</script>
</head>
<body>
</body>
</html>
|