From 1464180062e01c60cffa04628ce9ffe182022928 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 21 Nov 2024 13:16:56 +0100 Subject: [PATCH] Detect broken Firefox H.264 decoder 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. --- core/util/browser.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/util/browser.js b/core/util/browser.js index 7e0bb8ce1..ceb4fc40d 100644 --- a/core/util/browser.js +++ b/core/util/browser.js @@ -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({ @@ -136,6 +137,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; }