voelin-media: apply a camera's new background effect

A source's input was kept when its background changed as long as both
the old and the new effect needed a mask, but the background filter is
set up with its effect when the input starts. So switching a camera from
blur to a colour or an image, or changing the blur strength, changed the
scene and nothing on screen. The input now restarts whenever the effect
differs, as it already did when the effect went on or off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 06:44:55 +03:00
1 parent 6887cebb90
commit eaf91927cc
1 file changed
+23 -2
+23 -2
View File
@@ -798,8 +798,10 @@ impl Studio {
wanted.iter().any(|(w, kind, background)| {
w == id
&& input.kind().same_input(kind)
// A background filter is set up when the input starts.
&& input.background().needs_mask() == background.needs_mask()
// A background filter is set up when the input starts,
// with the effect it applies: another effect (or
// strength, image, colour) needs a new input.
&& input.background() == background
})
});
}
@@ -1196,6 +1198,25 @@ mod tests {
assert!(studio.apply(Command::RenameScene { scene: 99, name: "x".into() }).await.is_err());
}
#[tokio::test]
async fn a_new_background_effect_reaches_the_input() {
let studio = Studio::start(one_colour_scene()).await.unwrap();
for background in [
Background::Blur { strength: 0.02 },
Background::Blur { strength: 0.08 },
Background::Colour { colour: Colour::rgb(0, 200, 0) },
Background::Keep,
] {
let change =
SourceChange { background: Some(background.clone()), ..Default::default() };
let command = Command::UpdateSource { scene: 1, source: 1, change: Box::new(change) };
studio.apply(command).await.unwrap();
let graph = lock(&studio.graph);
assert_eq!(graph.inputs.len(), 1);
assert_eq!(graph.inputs[0].1.background(), &background);
}
}
#[tokio::test]
async fn go_live_and_recording_change_the_status() {
let studio = Studio::start(one_colour_scene()).await.unwrap();