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

simplify server for record-audio-video-stream #39

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

Conversation

ThisIsMissEm
Copy link

As only one stream can be maintained at a time, this change moves to just holding on to one stream and closing it before opening a new one. If we receive audio data after the stream is changed, then the stream ID won't match the global STREAM_ID counter. Furthermore, by using only a single stream instance we can simplify the merging process, as we've just a list of files as a result. Additionally, the previous code used clearTimeout on a setInterval, which seemed like a bug.

I wasn't sure if a video could change it's frame-size whilst you're receiving frames, which seems a little odd. Furthermore, a change in size would likely corrupt the entire recording as the two video files to merge would be mismatched in resolution (size).

n.b., I've not had a chance to actually test this code, as I've authored this via GitHub, but it should work and give the same results. This is perhaps a more explicit way of writing the previous code's logic.

As only one stream can be maintained at a time, this change moves to just holding on to one stream and closing it before opening a new one. If we receive audio data after the stream is changed, then the stream ID won't match the global `STREAM_ID` counter. Furthermore, by using only a single stream instance we can simplify the merging process, as we've just a list of files as a result. Additionally, the previous code used clearTimeout on a setInterval, which seemed like a bug.

I wasn't sure if a video could change it's frame-size whilst you're receiving frames, which seems a little odd. Furthermore, a change in size would likely corrupt the entire recording as the two video files to merge would be mismatched in resolution (size).

n.b., I've not had a chance to actually test this code, as I've authored this via GitHub, but it should give the same results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant