Fix/webcam streamer resource leaks - #4
Merged
Conversation
* fix(presets): fix edit/update preset function Use deep clones to not store a reference to the formPreset. * refactor(presets): refactor some code parts for better readability
The HLS and JMuxer streamers used `beforeUnmount()`, which is a Vue 3
lifecycle hook. This project runs Vue 2.7, where the hook is named
`beforeDestroy`, so neither `hls.destroy()` nor `jmuxer.destroy()` ever
ran. Every visit to a page showing one of these cameras left a decoder
and its network stream running for the rest of the session.
Hlsstreamer additionally called `play()` from `updated()`, tearing down
and rebuilding the entire Hls instance on every re-render. The `isVisible`
field — written by `v-observe-visibility` but never read — made this fire
whenever the video scrolled in or out of the viewport. Replace it with a
`@Watch('url')`, so the stream restarts only when its source actually
changes, and drop the now-unused visibility tracking.
JMuxerStream held its WebSocket in a local `const`, so nothing could
close it. Each `camSettings` change opened another socket while the old
one stayed open and kept feeding the newly created jmuxer. Keep the
socket on the instance, close it in `stop()`, and guard the handlers on
socket identity so a socket that is still closing cannot feed a newer
decoder.
Signed-off-by: Åsmund Collin <aakjaergaard@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings
[optional] Are there any post-deployment tasks we need to perform?