Skip to content
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

Fix a bug where the source node gets reclaimed by the GC #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eeror
Copy link

@eeror eeror commented Jun 19, 2019

Let's say the user of the library initializes it like this:

const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
const source = audioContext.createMediaStreamSource(stream)
const recorder = new WebAudioRecorder(source, recorderConfiguration)

At least in the newest version of Chrome, if source goes out of scope and gets reclaimed by the GC, the script processor will start receiving zeroes and record silence as a result.

If the user creates a source node just to pass it on to the recorder, it would be a leaky abstraction to require the user to keep a reference to it themselves. This pull request makes the library store a reference to the source node so the user wouldn't have to.

This will most likely fix #18, fix #28, and fix #29.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant