From a89dfd61415afd8137f22fdde8d863346fee1ade Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 21 Nov 2024 13:16:17 +0100 Subject: [PATCH] Handle exceptions from VideoDecoder.flush() These are not supposed to happen according to the specification, but Firefox has some bug and throws them anyway. --- core/util/browser.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/util/browser.js b/core/util/browser.js index 23f3d3e9..b55264fe 100644 --- a/core/util/browser.js +++ b/core/util/browser.js @@ -127,7 +127,13 @@ async function _checkWebCodecsH264DecodeSupport() { decoder.configure(config); decoder.decode(chunk); - await decoder.flush(); + try { + await decoder.flush(); + } catch (e) { + // Firefox incorrectly throws an exception here + // https://bugzilla.mozilla.org/show_bug.cgi?id=1932566 + error = e; + } if (error !== null) { return false;