From 7333db32280ee7e40788ad7e3fb8d988eb8a4df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Cardoso?= Date: Fri, 21 Apr 2023 09:54:08 -0300 Subject: [PATCH] src: stream: Fix default streams not starting up after a single reset --- src/stream/manager.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/stream/manager.rs b/src/stream/manager.rs index 065d1c20..b338582b 100644 --- a/src/stream/manager.rs +++ b/src/stream/manager.rs @@ -115,11 +115,15 @@ pub fn remove_all_streams() -> Result<()> { #[instrument(level = "debug")] pub fn start_default() -> Result<()> { - // First of all, gently remove all streams as we are going to replace the entire list below - remove_all_streams()?; - + // Get streams from default settings, this needs to be done first because + // remove_all_streams will modify the settings as its using the stream manager + // to remove the streams, and the stream manager will save the state after + // each removal in the settings let mut streams = settings::manager::streams(); + // Gently remove all streams as we are going to replace the entire list below + remove_all_streams()?; + // Update all local video sources to make sure that they are available let mut candidates = video_source::cameras_available(); update_devices(&mut streams, &mut candidates);