Closed crazoter closed 5 years ago
Fixed by using a web worker and directly processing the PCM data through AudioBuffer.getChannelData() instead of a OfflineAudioContext.
Memory leak in the application (or at least, non garbage collected items) are no longer present based on Chrome's Task Manager & running a webcast from start to end
OfflineAudioContext is not garbage collected. As a result, its audio worklet is not garbage collected and their threads are also not terminated. The problem is OfflineAudioContext cannot be reused. Considering how I don't see any references to the offline context outside of the defined function, this looks like a bug with the Chrome browser itself.
However, testing indicates that there should be no issue, even after thousands and thousands of these threads have been spawned (but it started lagging after spawning ~6000 ish of them lol). Should be okay for our use case.