-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VideoTexture: Fix error when detecting requestVideoFrameCallback #20449
Conversation
Fixes `TypeError: video is not an Object.` regression in mrdoob#19906
So to clarify: This issue only happens if a video texture is cloned. Notice that the first parameter of However, I'm not sure this change is correct. When a |
For more context- I ran into the issue updating three where a
Let me know if there is a better way... the intention is for each instance of |
Maybe it's better to do the following for now: if ( video !== undefined && 'requestVideoFrameCallback' in video ) { Besides, one could also investigate if it's possible to move the usage of |
Yeah, I was also thinking about that approach. One issue is that if the if ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) { The |
The additional
Not sure I understand this argument. |
Sorry, let me try to clarify- In my testing update: function () {
const video = this.image;
const hasVideoFrameCallback = 'requestVideoFrameCallback' in video;
if ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {
this.needsUpdate = true;
}
} So in environments where |
Okay, that cleared things up. The missing assignment to I'm still not sure it's safe to use It seems this issue could be easier solved with #17949 merged. Keep in mind that when cloning a (video) texture right now, you have duplicate uploads to the GPU. Which is probably not something you want. |
I agree... out of curiosity, I dug into the Chrome source. It looks like work is done once per frame and then shared by all callbacks: Everything appears to scale safely depending on how heavy the callbacks themselves are. In this test I'm able to add around 768 callback loops before things begin to exceed the frame window on a MacBook Pro. And around 512 loops on a Pixel 2 XL.
Yeah, I didn't realize what |
All right, then I guess it's okay to merge this for now. One might refactor this code when duplicate texture uploads are solved. |
Thanks! |
Fixes
TypeError: video is not an Object.
regression in #19906Related issues:
#19906
Description
When
VideoTexture
is constructed with an undefined video, therequestVideoFrameCallback
detection on line 24 throws an error.