Skip to content

Commit

Permalink
Detect broken Firefox H.264 decoder
Browse files Browse the repository at this point in the history
The Firefox H.264 decoder on Windows might simply just refuse to deliver
any finished frames. It also doesn't deliver any errors.

Detect this early by expecting a frame after flush() has completed.
  • Loading branch information
CendioOssman committed Nov 21, 2024
1 parent a89dfd6 commit 2463ccd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/util/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ async function _checkWebCodecsH264DecodeSupport() {
'NjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFx' +
'PTE6MS4wMACAAAABZYiEBrxmKAAPVccAAS044AA5DRJMnkycJk4TPw=='));

let gotframe = false;
let error = null;

let decoder = new VideoDecoder({
output: (frame) => {},
output: (frame) => { gotframe = true; },
error: (e) => { error = e; },
});
let chunk = new EncodedVideoChunk({
Expand All @@ -135,6 +136,13 @@ async function _checkWebCodecsH264DecodeSupport() {
error = e;
}

// Firefox fails to deliver the error on Windows, so we need to
// check if we got a frame instead
// https://bugzilla.mozilla.org/show_bug.cgi?id=1932579
if (!gotframe) {
return false;
}

if (error !== null) {
return false;
}
Expand Down

0 comments on commit 2463ccd

Please sign in to comment.