From 27237876210f47a9f79f653a8e6e49fbb7739f7c Mon Sep 17 00:00:00 2001 From: Jiajie Hu Date: Mon, 1 Aug 2022 15:02:42 +0800 Subject: [PATCH] De-flake fromPixels test failure `HTMLVideoElement.requestVideoFrameCallback()` provides a realiable way to guarantee the readiness of a video frame, whereas the browser may not update the ready state until a few frames later. In such cases, false alarms will be raised by the validation in `fromPixels()`. Fixes #6577 --- tfjs-core/src/ops/browser.ts | 10 ---------- tfjs-core/src/ops/from_pixels_test.ts | 9 --------- 2 files changed, 19 deletions(-) diff --git a/tfjs-core/src/ops/browser.ts b/tfjs-core/src/ops/browser.ts index 6a812317b1e..d75463bed14 100644 --- a/tfjs-core/src/ops/browser.ts +++ b/tfjs-core/src/ops/browser.ts @@ -107,16 +107,6 @@ function fromPixels_( ` or {data: Uint32Array, width: number, height: number}, ` + `but was ${(pixels as {}).constructor.name}`); } - if (isVideo) { - const HAVE_CURRENT_DATA_READY_STATE = 2; - if (isVideo && - (pixels as HTMLVideoElement).readyState < - HAVE_CURRENT_DATA_READY_STATE) { - throw new Error( - 'The video element has not loaded data yet. Please wait for ' + - '`loadeddata` event on the