BlueGit

ict rusty-teams

fix(calls): second review round - Meet now guard, camera preview during calls, saved camera for new calls

- Meet now in-flight guard sits in start_meet_now, meeting-code joins no longer dropped
- Settings camera preview pauses for the whole call, not only once the call camera is on
- camera pick prefers 30 fps over higher rates at the same size
- background preview applies image loads under the request lock
- saved camera reaches the engine before a call starts or a ring is answered
- mini window opens within 250 ms when idle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-11 · 7 weeks ago

Hash
80d2aeb7c1e62f84890f96b88f981a3751b88ba9
Parent
7fc73b2d
9 files changed +42 −14
crates/app/src/app_state.rs +4 −1
@@ -741,7 +741,10 @@ impl AppState {
741 741 self.connection = connection;
742 742 cx.emit(AppEvent::Status);
743 743 }
744 BackendEvent::Calls(launcher) => self.call_launcher = Some(launcher),
744 BackendEvent::Calls(launcher) => {
745 launcher.set_default_camera(self.call_camera.clone());
746 self.call_launcher = Some(launcher);
747 }
745 748 BackendEvent::Calendar(events) => self.apply_calendar(events, cx),
746 749 BackendEvent::CalendarNudge(nudge) => self.calendar_nudge = Some(nudge),
747 750 BackendEvent::Ring(event) => self.on_engine_event(event, cx),
@@ -741,7 +741,10 @@ impl AppState {
741 self.connection = connection;
741 self.connection = connection;
742 cx.emit(AppEvent::Status);
742 cx.emit(AppEvent::Status);
743 }
743 }
744 BackendEvent::Calls(launcher) => self.call_launcher = Some(launcher),
744 BackendEvent::Calls(launcher) => {
745 launcher.set_default_camera(self.call_camera.clone());
746 self.call_launcher = Some(launcher);
747 }
745 BackendEvent::Calendar(events) => self.apply_calendar(events, cx),
748 BackendEvent::Calendar(events) => self.apply_calendar(events, cx),
746 BackendEvent::CalendarNudge(nudge) => self.calendar_nudge = Some(nudge),
749 BackendEvent::CalendarNudge(nudge) => self.calendar_nudge = Some(nudge),
747 BackendEvent::Ring(event) => self.on_engine_event(event, cx),
750 BackendEvent::Ring(event) => self.on_engine_event(event, cx),
crates/app/src/call/actions.rs +3 −0
@@ -313,6 +313,9 @@ impl AppState {
313 313 pub fn select_call_camera(&mut self, choice: DeviceChoice, _cx: &mut Context<Self>) {
314 314 let _ = self.store.set_meta(CAMERA_META_KEY, camera_meta(&choice));
315 315 self.call_camera = choice.clone();
316 if let Some(launcher) = &self.call_launcher {
317 launcher.set_default_camera(choice.clone());
318 }
316 319 if let Some(call) = self.call.as_mut() {
317 320 call.model.camera = choice.clone();
318 321 }
@@ -313,6 +313,9 @@ impl AppState {
313 pub fn select_call_camera(&mut self, choice: DeviceChoice, _cx: &mut Context<Self>) {
313 pub fn select_call_camera(&mut self, choice: DeviceChoice, _cx: &mut Context<Self>) {
314 let _ = self.store.set_meta(CAMERA_META_KEY, camera_meta(&choice));
314 let _ = self.store.set_meta(CAMERA_META_KEY, camera_meta(&choice));
315 self.call_camera = choice.clone();
315 self.call_camera = choice.clone();
316 if let Some(launcher) = &self.call_launcher {
317 launcher.set_default_camera(choice.clone());
318 }
316 if let Some(call) = self.call.as_mut() {
319 if let Some(call) = self.call.as_mut() {
317 call.model.camera = choice.clone();
320 call.model.camera = choice.clone();
318 }
321 }
crates/app/src/call/join.rs +3 −3
@@ -67,9 +67,6 @@ impl AppState {
67 67 return;
68 68 }
69 69 let meeting_data = code.meeting_data();
70 if self.meet_now_pending {
71 return;
72 }
73 70 if self.mode.demo {
74 71 let target = MeetingTarget {
75 72 thread_id: DEMO_CODE_THREAD.to_owned(),
@@ -111,6 +108,9 @@ impl AppState {
111 108 self.show_call(true, cx);
112 109 return;
113 110 }
111 if self.meet_now_pending {
112 return;
113 }
114 114 if self.mode.demo {
115 115 let target = MeetingTarget {
116 116 thread_id: DEMO_CODE_THREAD.to_owned(),
@@ -67,9 +67,6 @@ impl AppState {
67 return;
67 return;
68 }
68 }
69 let meeting_data = code.meeting_data();
69 let meeting_data = code.meeting_data();
70 if self.meet_now_pending {
71 return;
72 }
73 if self.mode.demo {
70 if self.mode.demo {
74 let target = MeetingTarget {
71 let target = MeetingTarget {
75 thread_id: DEMO_CODE_THREAD.to_owned(),
72 thread_id: DEMO_CODE_THREAD.to_owned(),
@@ -111,6 +108,9 @@ impl AppState {
111 self.show_call(true, cx);
108 self.show_call(true, cx);
112 return;
109 return;
113 }
110 }
111 if self.meet_now_pending {
112 return;
113 }
114 if self.mode.demo {
114 if self.mode.demo {
115 let target = MeetingTarget {
115 let target = MeetingTarget {
116 thread_id: DEMO_CODE_THREAD.to_owned(),
116 thread_id: DEMO_CODE_THREAD.to_owned(),
crates/app/src/call/launcher.rs +11 −1
@@ -4,7 +4,7 @@ use std::time::Duration;
4 4
5 5 use calling::meeting::{LiveMeeting, fetch_live_meeting};
6 6 use calling::{
7 AcceptMode, BackgroundCache, CallEngine, CallHandle, CallSpec, CallState, CallUpdate, DefaultBackground, EndReason, EngineConfig, EngineEvent, MeetingTarget, call_channel,
7 AcceptMode, BackgroundCache, CallEngine, DeviceChoice, CallHandle, CallSpec, CallState, CallUpdate, DefaultBackground, EndReason, EngineConfig, EngineEvent, MeetingTarget, call_channel,
8 8 };
9 9 use session::{Session, SessionConfig, Transport};
10 10
@@ -14,6 +14,7 @@ const NOT_READY: &str = "Calls are not ready yet";
14 14
15 15 pub struct CallLauncher {
16 16 engine: Mutex<Option<CallEngine>>,
17 default_camera: Mutex<DeviceChoice>,
17 18 }
18 19
19 20 impl CallLauncher {
@@ -24,12 +25,14 @@ impl CallLauncher {
24 25 ) -> Arc<CallLauncher> {
25 26 let launcher = Arc::new(CallLauncher {
26 27 engine: Mutex::new(None),
28 default_camera: Mutex::new(DeviceChoice::SystemDefault),
27 29 });
28 30 let running = launcher.clone();
29 31 crate::runtime::handle().spawn(async move {
30 32 let (engine, mut events) =
31 33 start_with_retry(|| start_engine(transport.clone(), ringable), &START_RETRY_STEPS, START_RETRY_STEADY).await;
32 34 crate::diagnostics::record("calls: engine ready, registered with the registrar");
35 engine.set_default_camera(running.default_camera.lock().expect("camera lock").clone());
33 36 *running.engine.lock().expect("engine lock") = Some(engine);
34 37 while let Some(event) = events.recv().await {
35 38 on_event(event);
@@ -42,6 +45,13 @@ impl CallLauncher {
42 45 self.engine.lock().expect("engine lock").clone()
43 46 }
44 47
48 pub fn set_default_camera(&self, camera: DeviceChoice) {
49 *self.default_camera.lock().expect("camera lock") = camera.clone();
50 if let Some(engine) = self.engine() {
51 engine.set_default_camera(camera);
52 }
53 }
54
45 55 pub fn start_call(&self, spec: CallSpec) -> CallHandle {
46 56 match self.engine() {
47 57 Some(engine) => engine.start_call(spec),
@@ -4,7 +4,7 @@ use std::time::Duration;
4
4
5use calling::meeting::{LiveMeeting, fetch_live_meeting};
5use calling::meeting::{LiveMeeting, fetch_live_meeting};
6use calling::{
6use calling::{
7 AcceptMode, BackgroundCache, CallEngine, CallHandle, CallSpec, CallState, CallUpdate, DefaultBackground, EndReason, EngineConfig, EngineEvent, MeetingTarget, call_channel,
7 AcceptMode, BackgroundCache, CallEngine, DeviceChoice, CallHandle, CallSpec, CallState, CallUpdate, DefaultBackground, EndReason, EngineConfig, EngineEvent, MeetingTarget, call_channel,
8};
8};
9use session::{Session, SessionConfig, Transport};
9use session::{Session, SessionConfig, Transport};
10
10
@@ -14,6 +14,7 @@ const NOT_READY: &str = "Calls are not ready yet";
14
14
15pub struct CallLauncher {
15pub struct CallLauncher {
16 engine: Mutex<Option<CallEngine>>,
16 engine: Mutex<Option<CallEngine>>,
17 default_camera: Mutex<DeviceChoice>,
17}
18}
18
19
19impl CallLauncher {
20impl CallLauncher {
@@ -24,12 +25,14 @@ impl CallLauncher {
24 ) -> Arc<CallLauncher> {
25 ) -> Arc<CallLauncher> {
25 let launcher = Arc::new(CallLauncher {
26 let launcher = Arc::new(CallLauncher {
26 engine: Mutex::new(None),
27 engine: Mutex::new(None),
28 default_camera: Mutex::new(DeviceChoice::SystemDefault),
27 });
29 });
28 let running = launcher.clone();
30 let running = launcher.clone();
29 crate::runtime::handle().spawn(async move {
31 crate::runtime::handle().spawn(async move {
30 let (engine, mut events) =
32 let (engine, mut events) =
31 start_with_retry(|| start_engine(transport.clone(), ringable), &START_RETRY_STEPS, START_RETRY_STEADY).await;
33 start_with_retry(|| start_engine(transport.clone(), ringable), &START_RETRY_STEPS, START_RETRY_STEADY).await;
32 crate::diagnostics::record("calls: engine ready, registered with the registrar");
34 crate::diagnostics::record("calls: engine ready, registered with the registrar");
35 engine.set_default_camera(running.default_camera.lock().expect("camera lock").clone());
33 *running.engine.lock().expect("engine lock") = Some(engine);
36 *running.engine.lock().expect("engine lock") = Some(engine);
34 while let Some(event) = events.recv().await {
37 while let Some(event) = events.recv().await {
35 on_event(event);
38 on_event(event);
@@ -42,6 +45,13 @@ impl CallLauncher {
42 self.engine.lock().expect("engine lock").clone()
45 self.engine.lock().expect("engine lock").clone()
43 }
46 }
44
47
48 pub fn set_default_camera(&self, camera: DeviceChoice) {
49 *self.default_camera.lock().expect("camera lock") = camera.clone();
50 if let Some(engine) = self.engine() {
51 engine.set_default_camera(camera);
52 }
53 }
54
45 pub fn start_call(&self, spec: CallSpec) -> CallHandle {
55 pub fn start_call(&self, spec: CallSpec) -> CallHandle {
46 match self.engine() {
56 match self.engine() {
47 Some(engine) => engine.start_call(spec),
57 Some(engine) => engine.start_call(spec),
crates/app/src/call/overlay.rs +1 −1
@@ -15,7 +15,7 @@ use crate::views::call_mini_window::MiniWindowView;
15 15 use crate::views::share_bar::{ShareBarView, ShareBorderView};
16 16
17 17 const TICK: Duration = Duration::from_millis(100);
18 const IDLE_TICK: Duration = Duration::from_secs(1);
18 const IDLE_TICK: Duration = Duration::from_millis(250);
19 19 const SLOW_TICK_EVERY: u32 = 5;
20 20 const BORDER_SIDES: usize = 4;
21 21
@@ -15,7 +15,7 @@ use crate::views::call_mini_window::MiniWindowView;
15use crate::views::share_bar::{ShareBarView, ShareBorderView};
15use crate::views::share_bar::{ShareBarView, ShareBorderView};
16
16
17const TICK: Duration = Duration::from_millis(100);
17const TICK: Duration = Duration::from_millis(100);
18const IDLE_TICK: Duration = Duration::from_secs(1);
18const IDLE_TICK: Duration = Duration::from_millis(250);
19const SLOW_TICK_EVERY: u32 = 5;
19const SLOW_TICK_EVERY: u32 = 5;
20const BORDER_SIDES: usize = 4;
20const BORDER_SIDES: usize = 4;
21
21
crates/app/src/call/preview.rs +10 −6
@@ -21,7 +21,7 @@ pub struct CameraPreview {
21 21 hub: Arc<VideoHub>,
22 22 pictures: CallPictures,
23 23 blur: Arc<BlurSettings>,
24 background_request: Arc<AtomicU64>,
24 background_request: Arc<Mutex<u64>>,
25 25 capture: Option<Capture>,
26 26 frames: Arc<AtomicU64>,
27 27 failure: Arc<Mutex<Option<String>>>,
@@ -36,7 +36,7 @@ impl CameraPreview {
36 36 hub: VideoHub::new(sender),
37 37 pictures: CallPictures::default(),
38 38 blur: Arc::new(BlurSettings::default()),
39 background_request: Arc::new(AtomicU64::new(0)),
39 background_request: Arc::new(Mutex::new(0)),
40 40 capture: None,
41 41 frames: Arc::new(AtomicU64::new(0)),
42 42 failure: Arc::new(Mutex::new(None)),
@@ -73,7 +73,9 @@ impl CameraPreview {
73 73 }
74 74
75 75 pub fn set_background(&self, choice: BackgroundChoice) {
76 let request = self.background_request.fetch_add(1, Ordering::SeqCst) + 1;
76 let mut latest = self.background_request.lock().expect("background request lock");
77 *latest += 1;
78 let request = *latest;
77 79 match choice {
78 80 BackgroundChoice::None => self.apply_background(false, None),
79 81 BackgroundChoice::Blur => self.apply_background(true, None),
@@ -81,9 +83,11 @@ impl CameraPreview {
81 83 let blur = self.blur.clone();
82 84 let latest_request = self.background_request.clone();
83 85 std::thread::spawn(move || {
84 if let Ok(picture) = BackgroundPicture::load(&path)
85 && latest_request.load(Ordering::SeqCst) == request
86 {
86 let Ok(picture) = BackgroundPicture::load(&path) else {
87 return;
88 };
89 let latest = latest_request.lock().expect("background request lock");
90 if *latest == request {
87 91 blur.set_picture(Some(Arc::new(picture)));
88 92 blur.set_enabled(true);
89 93 }
@@ -21,7 +21,7 @@ pub struct CameraPreview {
21 hub: Arc<VideoHub>,
21 hub: Arc<VideoHub>,
22 pictures: CallPictures,
22 pictures: CallPictures,
23 blur: Arc<BlurSettings>,
23 blur: Arc<BlurSettings>,
24 background_request: Arc<AtomicU64>,
24 background_request: Arc<Mutex<u64>>,
25 capture: Option<Capture>,
25 capture: Option<Capture>,
26 frames: Arc<AtomicU64>,
26 frames: Arc<AtomicU64>,
27 failure: Arc<Mutex<Option<String>>>,
27 failure: Arc<Mutex<Option<String>>>,
@@ -36,7 +36,7 @@ impl CameraPreview {
36 hub: VideoHub::new(sender),
36 hub: VideoHub::new(sender),
37 pictures: CallPictures::default(),
37 pictures: CallPictures::default(),
38 blur: Arc::new(BlurSettings::default()),
38 blur: Arc::new(BlurSettings::default()),
39 background_request: Arc::new(AtomicU64::new(0)),
39 background_request: Arc::new(Mutex::new(0)),
40 capture: None,
40 capture: None,
41 frames: Arc::new(AtomicU64::new(0)),
41 frames: Arc::new(AtomicU64::new(0)),
42 failure: Arc::new(Mutex::new(None)),
42 failure: Arc::new(Mutex::new(None)),
@@ -73,7 +73,9 @@ impl CameraPreview {
73 }
73 }
74
74
75 pub fn set_background(&self, choice: BackgroundChoice) {
75 pub fn set_background(&self, choice: BackgroundChoice) {
76 let request = self.background_request.fetch_add(1, Ordering::SeqCst) + 1;
76 let mut latest = self.background_request.lock().expect("background request lock");
77 *latest += 1;
78 let request = *latest;
77 match choice {
79 match choice {
78 BackgroundChoice::None => self.apply_background(false, None),
80 BackgroundChoice::None => self.apply_background(false, None),
79 BackgroundChoice::Blur => self.apply_background(true, None),
81 BackgroundChoice::Blur => self.apply_background(true, None),
@@ -81,9 +83,11 @@ impl CameraPreview {
81 let blur = self.blur.clone();
83 let blur = self.blur.clone();
82 let latest_request = self.background_request.clone();
84 let latest_request = self.background_request.clone();
83 std::thread::spawn(move || {
85 std::thread::spawn(move || {
84 if let Ok(picture) = BackgroundPicture::load(&path)
86 let Ok(picture) = BackgroundPicture::load(&path) else {
85 && latest_request.load(Ordering::SeqCst) == request
87 return;
86 {
88 };
89 let latest = latest_request.lock().expect("background request lock");
90 if *latest == request {
87 blur.set_picture(Some(Arc::new(picture)));
91 blur.set_picture(Some(Arc::new(picture)));
88 blur.set_enabled(true);
92 blur.set_enabled(true);
89 }
93 }
crates/app/src/notify/settings_view.rs +1 −1
@@ -28,7 +28,7 @@ const PREVIEW_RADIUS: f32 = 10.;
28 28 const CAMERA_IN_USE: &str = "Camera is in use by the call";
29 29
30 30 fn camera_in_call(state: &AppState) -> bool {
31 state.call.as_ref().is_some_and(|call| call.model.camera_on)
31 state.call.is_some()
32 32 }
33 33
34 34 #[derive(Clone, Copy, PartialEq, Eq)]
@@ -28,7 +28,7 @@ const PREVIEW_RADIUS: f32 = 10.;
28const CAMERA_IN_USE: &str = "Camera is in use by the call";
28const CAMERA_IN_USE: &str = "Camera is in use by the call";
29
29
30fn camera_in_call(state: &AppState) -> bool {
30fn camera_in_call(state: &AppState) -> bool {
31 state.call.as_ref().is_some_and(|call| call.model.camera_on)
31 state.call.is_some()
32}
32}
33
33
34#[derive(Clone, Copy, PartialEq, Eq)]
34#[derive(Clone, Copy, PartialEq, Eq)]
crates/calling/src/camera.rs +1 −1
@@ -79,7 +79,7 @@ fn pick_format(formats: &[CameraFormat]) -> Option<CameraFormat> {
79 79 .copied()
80 80 .filter(|format| DIRECT_FORMATS.contains(&format.format()))
81 81 .filter(|format| format.frame_rate() >= CAPTURE_FPS && format.height() <= CAPTURE_HEIGHT)
82 .max_by_key(|format| (format.height(), format_rank(format.format()), format.frame_rate()))
82 .max_by_key(|format| (format.height(), format_rank(format.format()), std::cmp::Reverse(format.frame_rate())))
83 83 }
84 84
85 85 fn open_picked_format(index: CameraIndex) -> std::result::Result<Camera, nokhwa::NokhwaError> {
@@ -79,7 +79,7 @@ fn pick_format(formats: &[CameraFormat]) -> Option<CameraFormat> {
79 .copied()
79 .copied()
80 .filter(|format| DIRECT_FORMATS.contains(&format.format()))
80 .filter(|format| DIRECT_FORMATS.contains(&format.format()))
81 .filter(|format| format.frame_rate() >= CAPTURE_FPS && format.height() <= CAPTURE_HEIGHT)
81 .filter(|format| format.frame_rate() >= CAPTURE_FPS && format.height() <= CAPTURE_HEIGHT)
82 .max_by_key(|format| (format.height(), format_rank(format.format()), format.frame_rate()))
82 .max_by_key(|format| (format.height(), format_rank(format.format()), std::cmp::Reverse(format.frame_rate())))
83}
83}
84
84
85fn open_picked_format(index: CameraIndex) -> std::result::Result<Camera, nokhwa::NokhwaError> {
85fn open_picked_format(index: CameraIndex) -> std::result::Result<Camera, nokhwa::NokhwaError> {
crates/calling/src/engine.rs +8 −0
@@ -10,6 +10,7 @@ use tokio::task::JoinHandle;
10 10 use tokio::time::timeout;
11 11
12 12 use crate::call::{AcceptMode, CallOptions, CallSpec, IncomingCall, Plan};
13 use crate::devices::DeviceChoice;
13 14 use crate::control::{CallHandle, call_channel};
14 15 use crate::end::EndKind;
15 16 use crate::error::{Error, Result};
@@ -109,6 +110,7 @@ pub(crate) struct Inner {
109 110 rings: Mutex<HashMap<u64, mpsc::UnboundedSender<RingCommand>>>,
110 111 seen: Mutex<HashMap<(String, String), Instant>>,
111 112 next_ring_id: AtomicU64,
113 default_camera: Mutex<DeviceChoice>,
112 114 runtime: tokio::runtime::Handle,
113 115 events: mpsc::UnboundedSender<EngineEvent>,
114 116 stop: Mutex<Option<oneshot::Sender<()>>>,
@@ -153,6 +155,7 @@ impl Inner {
153 155 relay_host: self.config.relay_host.clone(),
154 156 routing: self.config.routing.clone(),
155 157 trace: self.config.trace,
158 camera: self.default_camera.lock().expect("default camera lock").clone(),
156 159 ..CallOptions::default()
157 160 }
158 161 }
@@ -237,6 +240,7 @@ impl CallEngine {
237 240 rings: Mutex::default(),
238 241 seen: Mutex::default(),
239 242 next_ring_id: AtomicU64::new(RING_ID_START),
243 default_camera: Mutex::new(DeviceChoice::SystemDefault),
240 244 runtime: tokio::runtime::Handle::current(),
241 245 events,
242 246 stop: Mutex::new(Some(stop)),
@@ -279,6 +283,10 @@ impl CallEngine {
279 283 }
280 284
281 285 /// Only for a click on Decline: it ends the call for all of the user's devices.
286 pub fn set_default_camera(&self, camera: DeviceChoice) {
287 *self.inner.default_camera.lock().expect("default camera lock") = camera;
288 }
289
282 290 pub fn decline_ring(&self, ring_id: u64) {
283 291 self.send_ring_command(ring_id, RingCommand::Decline);
284 292 }
@@ -10,6 +10,7 @@ use tokio::task::JoinHandle;
10use tokio::time::timeout;
10use tokio::time::timeout;
11
11
12use crate::call::{AcceptMode, CallOptions, CallSpec, IncomingCall, Plan};
12use crate::call::{AcceptMode, CallOptions, CallSpec, IncomingCall, Plan};
13use crate::devices::DeviceChoice;
13use crate::control::{CallHandle, call_channel};
14use crate::control::{CallHandle, call_channel};
14use crate::end::EndKind;
15use crate::end::EndKind;
15use crate::error::{Error, Result};
16use crate::error::{Error, Result};
@@ -109,6 +110,7 @@ pub(crate) struct Inner {
109 rings: Mutex<HashMap<u64, mpsc::UnboundedSender<RingCommand>>>,
110 rings: Mutex<HashMap<u64, mpsc::UnboundedSender<RingCommand>>>,
110 seen: Mutex<HashMap<(String, String), Instant>>,
111 seen: Mutex<HashMap<(String, String), Instant>>,
111 next_ring_id: AtomicU64,
112 next_ring_id: AtomicU64,
113 default_camera: Mutex<DeviceChoice>,
112 runtime: tokio::runtime::Handle,
114 runtime: tokio::runtime::Handle,
113 events: mpsc::UnboundedSender<EngineEvent>,
115 events: mpsc::UnboundedSender<EngineEvent>,
114 stop: Mutex<Option<oneshot::Sender<()>>>,
116 stop: Mutex<Option<oneshot::Sender<()>>>,
@@ -153,6 +155,7 @@ impl Inner {
153 relay_host: self.config.relay_host.clone(),
155 relay_host: self.config.relay_host.clone(),
154 routing: self.config.routing.clone(),
156 routing: self.config.routing.clone(),
155 trace: self.config.trace,
157 trace: self.config.trace,
158 camera: self.default_camera.lock().expect("default camera lock").clone(),
156 ..CallOptions::default()
159 ..CallOptions::default()
157 }
160 }
158 }
161 }
@@ -237,6 +240,7 @@ impl CallEngine {
237 rings: Mutex::default(),
240 rings: Mutex::default(),
238 seen: Mutex::default(),
241 seen: Mutex::default(),
239 next_ring_id: AtomicU64::new(RING_ID_START),
242 next_ring_id: AtomicU64::new(RING_ID_START),
243 default_camera: Mutex::new(DeviceChoice::SystemDefault),
240 runtime: tokio::runtime::Handle::current(),
244 runtime: tokio::runtime::Handle::current(),
241 events,
245 events,
242 stop: Mutex::new(Some(stop)),
246 stop: Mutex::new(Some(stop)),
@@ -279,6 +283,10 @@ impl CallEngine {
279 }
283 }
280
284
281 /// Only for a click on Decline: it ends the call for all of the user's devices.
285 /// Only for a click on Decline: it ends the call for all of the user's devices.
286 pub fn set_default_camera(&self, camera: DeviceChoice) {
287 *self.inner.default_camera.lock().expect("default camera lock") = camera;
288 }
289
282 pub fn decline_ring(&self, ring_id: u64) {
290 pub fn decline_ring(&self, ring_id: u64) {
283 self.send_ring_command(ring_id, RingCommand::Decline);
291 self.send_ring_command(ring_id, RingCommand::Decline);
284 }
292 }