tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

Strengthen frame readiness while testing fromPixels with video element

Open hujiajie opened this issue 1 year ago • 3 comments

This fixes the error in WebGPU-backed unit tests:

OperationError: Failed to execute 'importExternalTexture' on 'GPUDevice': Failed to import texture from video element that doesn't have back resource.

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

hujiajie avatar Aug 09 '22 08:08 hujiajie

The original readyState check is not deleted because of concerns on old browsers.

The original readyState check is left as compulsory even when rvfc is present because having a unified codepath that optionally awaits for the rvfc is nicer than divergent behavior.

hujiajie avatar Aug 09 '22 08:08 hujiajie

Another place that has readState check is tfjs-data/src/util/test_utils.ts. I'm not sure if we need to also fix it. Given waiting for video is useful in multiple places, can we implement it as a utility function?

gyagp avatar Aug 09 '22 15:08 gyagp

Another place that has readState check is tfjs-data/src/util/test_utils.ts. I'm not sure if we need to also fix it.

I'm not sure either. Let me wait for more feedback.

Given waiting for video is useful in multiple places, can we implement it as a utility function?

Maybe, but why it was not a helper before? And is there anything changed so you are proposing this now?

hujiajie avatar Aug 10 '22 00:08 hujiajie

Another place that has readState check is tfjs-data/src/util/test_utils.ts. I'm not sure if we need to also fix it.

I'm not sure either. Let me wait for more feedback.

I think it's better to fix all the places.

Given waiting for video is useful in multiple places, can we implement it as a utility function?

Maybe, but why it was not a helper before? And is there anything changed so you are proposing this now?

To guarantee video is loaded is not straightforward and simple as we expected. That's the change from our previous understanding, so a helper function can be handy and sync all the related code on the same page.

gyagp avatar Aug 10 '22 06:08 gyagp