Skip to content

Commit

Permalink
TEST DECODE
Browse files Browse the repository at this point in the history
  • Loading branch information
CendioOssman committed Nov 21, 2024
1 parent 609d46c commit 0c04fa5
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion tests/test.h264.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,50 @@ async function haveH264Decode() {

let support = await VideoDecoder.isConfigSupported(config);
console.log(support);

Check failure on line 53 in tests/test.h264.js

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement
_haveH264Decode = support.supported;
if (!support.supported) {
_haveH264Decode = false;
return false;
}

// Firefox incorrectly reports supports for H.264 under some
// circumstances, so we need to actually test a real frame
// https://bugzilla.mozilla.org/show_bug.cgi?id=1932392

const data = new Uint8Array(Base64.decode(
'AAAAAWdCwBTZnpuAgICgAAADACAAAAZB4oVNAAAAAWjJYyyAAAABBgX//4Hc' +
'Rem95tlIt5Ys2CDZI+7veDI2NCAtIGNvcmUgMTY0IHIzMTA4IDMxZTE5Zjkg' +
'LSBILjI2NC9NUEVHLTQgQVZDIGNvZGVjIC0gQ29weWxlZnQgMjAwMy0yMDIz' +
'IC0gaHR0cDovL3d3dy52aWRlb2xhbi5vcmcveDI2NC5odG1sIC0gb3B0aW9u' +
'czogY2FiYWM9MCByZWY9NSBkZWJsb2NrPTE6MDowIGFuYWx5c2U9MHgxOjB4' +
'MTExIG1lPWhleCBzdWJtZT04IHBzeT0xIHBzeV9yZD0xLjAwOjAuMDAgbWl4' +
'ZWRfcmVmPTEgbWVfcmFuZ2U9MTYgY2hyb21hX21lPTEgdHJlbGxpcz0yIDh4' +
'OGRjdD0wIGNxbT0wIGRlYWR6b25lPTIxLDExIGZhc3RfcHNraXA9MSBjaHJv' +
'bWFfcXBfb2Zmc2V0PS0yIHRocmVhZHM9MSBsb29rYWhlYWRfdGhyZWFkcz0x' +
'IHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9' +
'MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVz' +
'PTAgd2VpZ2h0cD0wIGtleWludD1pbmZpbml0ZSBrZXlpbnRfbWluPTI1IHNj' +
'ZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NTAgcmM9' +
'YWJyIG1idHJlZT0xIGJpdHJhdGU9NDAwIHJhdGV0b2w9MS4wIHFjb21wPTAu' +
'NjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFx' +
'PTE6MS4wMACAAAABZYiEBrxmKAAPVccAAS044AA5DRJMnkycJk4TPw=='));

let error = null;

let decoder = new VideoDecoder({
output: frame => {},

Check failure on line 84 in tests/test.h264.js

View workflow job for this annotation

GitHub Actions / eslint

Expected parentheses around arrow function argument having a body with curly braces
error: e => { error = e; },

Check failure on line 85 in tests/test.h264.js

View workflow job for this annotation

GitHub Actions / eslint

Expected parentheses around arrow function argument having a body with curly braces
});
let chunk = new EncodedVideoChunk({
timestamp: 0,
type: 'key',
data: data,
});

decoder.configure(config);
decoder.decode(chunk);
await decoder.flush();

_haveH264Decode = error === null;

return _haveH264Decode;
}
Expand Down

0 comments on commit 0c04fa5

Please sign in to comment.