-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
DRAFT: Potencial fix for VideoTexture #24758
Conversation
const hasVideoFrameCallback = 'requestVideoFrameCallback' in video; | ||
|
||
if ( hasVideoFrameCallback && video !== this._callbackSource ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should stop the previous callback loop when creating a new one (by storing the callback ID and calling cancelVideoFrameCallback
on it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is problem.
We should store and callbackId and source reference, that add already 2 extra field to instance, what is undesirable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to solve would be just to check in update
function whether the callback source and the video are still the same, and request callback only if they still are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check can be made in the start of update
, so if the video changes the old callback would return before setting needsUpdate
to true
.
update is ticks with render FPS, and you can't requiest video callback from update each call.
But you do currently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this will siplify code.
this._callbackSource = video; | ||
|
||
const update = () => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( this._callbackSource !== video ) return; | |
A simpler alternative to 1469756.
Sorry, but I think the PR introduces a complexity in |
Related issue: #24757
Description
Check texture reference in
update
method safly, null supported.DRAFT, this is as idea!