jumpcutter icon indicating copy to clipboard operation
jumpcutter copied to clipboard

fix: video gets stuck at silenceSpeed for a while when performing processing-heavy actions on the page

Open WofWca opened this issue 3 years ago • 0 comments

For example, open a video on YouTube and then open dev tools (F12), or try resizing the window.

Could be the reason for https://github.com/WofWca/jumpcutter/issues/24#issuecomment-943971048.

What I think happens is that the main thread gets overloaded and can't process messages from SilenceDetectorNode in a timely manner:

https://github.com/WofWca/jumpcutter/blob/d81da1596a2dfa89a35bbc7b0cb0d28880f6f2e2/src/entry-points/content/StretchingController/StretchingController.ts#L384-L390

Not sure what we can do about this. Putting this listener on a separate thread (#88) would be perfect, but AFAIK it's not possible to access DOM from within Workers.

Maybe we could measure how loaded the main thread currently is and if it is quite busy, don't switch to silenceSpeed. Maybe requestIdleCallback could help, idk.

WofWca avatar Aug 02 '22 14:08 WofWca