BlueGit

ict rusty-teams

fix(hunt): open call findings and DST-aware list times (121b, 121a)

- call: no "Reconnecting" drop after the move to the meeting server
- call: accept has a setup timeout, broker polling survives an error
- call: hangup while waiting for the previous call declines the ring
- call: notice when the picked mic cannot be captured while sharing sound, default mic as fallback
- call: notice when the segmentation model cannot load
- call window reopens for a new call after a close
- list times in sidebar, switcher, quick views and call list follow DST of the date

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-14 · 2 weeks ago

Hash
3ecaf27a4ad92fcca6ae981eb5a23aa81cb5ad5a
Parent
77aa9274
17 files changed +156 −54
crates/app-state/src/call/calendar.rs +7 −4
@@ -1,7 +1,7 @@
1 1 use std::sync::OnceLock;
2 2
3 3 use chatsvc::CalendarEvent;
4 use chrono::{DateTime, Local, Offset, Utc};
4 use chrono::{DateTime, Utc};
5 5 use gpui_kit::Context;
6 6
7 7 use super::agenda::{AgendaRow, demo_events};
@@ -48,9 +48,12 @@ impl AppState {
48 48
49 49 pub fn rebuild_calls_list(&mut self, cx: &mut Context<Self>) {
50 50 let now = Utc::now();
51 let offset = Local::now().offset().fix();
52 self.calls_list
53 .rebuild(&self.call_history, &self.sidebar.chats, now, offset);
51 self.calls_list.rebuild(
52 &self.call_history,
53 &self.sidebar.chats,
54 now,
55 app_base::format::Zone::Local,
56 );
54 57 cx.emit(AppEvent::CallHistory);
55 58 cx.notify();
56 59 }
@@ -1,7 +1,7 @@
1use std::sync::OnceLock;
1use std::sync::OnceLock;
2
2
3use chatsvc::CalendarEvent;
3use chatsvc::CalendarEvent;
4use chrono::{DateTime, Local, Offset, Utc};
4use chrono::{DateTime, Utc};
5use gpui_kit::Context;
5use gpui_kit::Context;
6
6
7use super::agenda::{AgendaRow, demo_events};
7use super::agenda::{AgendaRow, demo_events};
@@ -48,9 +48,12 @@ impl AppState {
48
48
49 pub fn rebuild_calls_list(&mut self, cx: &mut Context<Self>) {
49 pub fn rebuild_calls_list(&mut self, cx: &mut Context<Self>) {
50 let now = Utc::now();
50 let now = Utc::now();
51 let offset = Local::now().offset().fix();
51 self.calls_list.rebuild(
52 self.calls_list
52 &self.call_history,
53 .rebuild(&self.call_history, &self.sidebar.chats, now, offset);
53 &self.sidebar.chats,
54 now,
55 app_base::format::Zone::Local,
56 );
54 cx.emit(AppEvent::CallHistory);
57 cx.emit(AppEvent::CallHistory);
55 cx.notify();
58 cx.notify();
56 }
59 }
crates/app-state/src/call/history.rs +10 −4
@@ -1,6 +1,7 @@
1 1 use std::collections::HashMap;
2 2
3 use chrono::{DateTime, Duration, FixedOffset, Utc};
3 use app_base::format::Zone;
4 use chrono::{DateTime, Duration, Utc};
4 5 use gpui_kit::Context;
5 6 use store::ChatRecord;
6 7 use teams_core::{CallDirection, CallLogEntry, CallOutcome};
@@ -79,12 +80,12 @@ pub fn call_rows<'a>(
79 80 entries: impl IntoIterator<Item = &'a CallLogEntry>,
80 81 chats: &[ChatRecord],
81 82 now: DateTime<Utc>,
82 offset: FixedOffset,
83 offset: Zone,
83 84 ) -> Vec<CallRow> {
84 85 let names = known_names(chats);
85 86 let chats_by_id: HashMap<&str, &ChatRecord> =
86 87 chats.iter().map(|chat| (chat.id.as_str(), chat)).collect();
87 let today = now.with_timezone(&offset).date_naive();
88 let today = offset.at(now).date_naive();
88 89 entries
89 90 .into_iter()
90 91 .map(|entry| {
@@ -358,7 +359,12 @@ mod tests {
358 359
359 360 fn rows(entries: &[CallLogEntry], chats: &[ChatRecord]) -> Vec<CallRow> {
360 361 let now = Utc.with_ymd_and_hms(2026, 10, 9, 12, 0, 0).unwrap();
361 call_rows(entries, chats, now, FixedOffset::east_opt(0).unwrap())
362 call_rows(
363 entries,
364 chats,
365 now,
366 chrono::FixedOffset::east_opt(0).unwrap().into(),
367 )
362 368 }
363 369
364 370 #[test]
@@ -1,6 +1,7 @@
1use std::collections::HashMap;
1use std::collections::HashMap;
2
2
3use chrono::{DateTime, Duration, FixedOffset, Utc};
3use app_base::format::Zone;
4use chrono::{DateTime, Duration, Utc};
4use gpui_kit::Context;
5use gpui_kit::Context;
5use store::ChatRecord;
6use store::ChatRecord;
6use teams_core::{CallDirection, CallLogEntry, CallOutcome};
7use teams_core::{CallDirection, CallLogEntry, CallOutcome};
@@ -79,12 +80,12 @@ pub fn call_rows<'a>(
79 entries: impl IntoIterator<Item = &'a CallLogEntry>,
80 entries: impl IntoIterator<Item = &'a CallLogEntry>,
80 chats: &[ChatRecord],
81 chats: &[ChatRecord],
81 now: DateTime<Utc>,
82 now: DateTime<Utc>,
82 offset: FixedOffset,
83 offset: Zone,
83) -> Vec<CallRow> {
84) -> Vec<CallRow> {
84 let names = known_names(chats);
85 let names = known_names(chats);
85 let chats_by_id: HashMap<&str, &ChatRecord> =
86 let chats_by_id: HashMap<&str, &ChatRecord> =
86 chats.iter().map(|chat| (chat.id.as_str(), chat)).collect();
87 chats.iter().map(|chat| (chat.id.as_str(), chat)).collect();
87 let today = now.with_timezone(&offset).date_naive();
88 let today = offset.at(now).date_naive();
88 entries
89 entries
89 .into_iter()
90 .into_iter()
90 .map(|entry| {
91 .map(|entry| {
@@ -358,7 +359,12 @@ mod tests {
358
359
359 fn rows(entries: &[CallLogEntry], chats: &[ChatRecord]) -> Vec<CallRow> {
360 fn rows(entries: &[CallLogEntry], chats: &[ChatRecord]) -> Vec<CallRow> {
360 let now = Utc.with_ymd_and_hms(2026, 10, 9, 12, 0, 0).unwrap();
361 let now = Utc.with_ymd_and_hms(2026, 10, 9, 12, 0, 0).unwrap();
361 call_rows(entries, chats, now, FixedOffset::east_opt(0).unwrap())
362 call_rows(
363 entries,
364 chats,
365 now,
366 chrono::FixedOffset::east_opt(0).unwrap().into(),
367 )
362 }
368 }
363
369
364 #[test]
370 #[test]
crates/app-state/src/call/list.rs +5 −3
@@ -1,5 +1,6 @@
1 1 use std::ops::Range;
2 2
3 use app_base::format::Zone;
3 4 use chrono::{DateTime, Duration, FixedOffset, NaiveDate, Utc};
4 5 use store::ChatRecord;
5 6 use teams_core::{CallDirection, CallLogEntry};
@@ -130,19 +131,20 @@ impl CallsList {
130 131 history: &[CallLogEntry],
131 132 chats: &[ChatRecord],
132 133 now: DateTime<Utc>,
133 offset: FixedOffset,
134 zone: impl Into<Zone>,
134 135 ) {
136 let zone = zone.into();
135 137 let mut entries = Vec::new();
136 138 let filter = self.filter;
137 139 let admitted = history.iter().filter(|entry| filter.admits(entry));
138 let calls = call_rows(admitted, chats, now, offset);
140 let calls = call_rows(admitted, chats, now, zone);
139 141 if calls.is_empty() {
140 142 entries.push(ListEntry::Empty(self.filter.empty_text()));
141 143 }
142 144 entries.extend(calls.into_iter().map(ListEntry::Call));
143 145 self.set_entries(entries);
144 146 self.built_at = Some(BuiltAt {
145 day: now.with_timezone(&offset).date_naive(),
147 day: zone.at(now).date_naive(),
146 148 time: now,
147 149 });
148 150 self.invalidated = false;
@@ -1,5 +1,6 @@
1use std::ops::Range;
1use std::ops::Range;
2
2
3use app_base::format::Zone;
3use chrono::{DateTime, Duration, FixedOffset, NaiveDate, Utc};
4use chrono::{DateTime, Duration, FixedOffset, NaiveDate, Utc};
4use store::ChatRecord;
5use store::ChatRecord;
5use teams_core::{CallDirection, CallLogEntry};
6use teams_core::{CallDirection, CallLogEntry};
@@ -130,19 +131,20 @@ impl CallsList {
130 history: &[CallLogEntry],
131 history: &[CallLogEntry],
131 chats: &[ChatRecord],
132 chats: &[ChatRecord],
132 now: DateTime<Utc>,
133 now: DateTime<Utc>,
133 offset: FixedOffset,
134 zone: impl Into<Zone>,
134 ) {
135 ) {
136 let zone = zone.into();
135 let mut entries = Vec::new();
137 let mut entries = Vec::new();
136 let filter = self.filter;
138 let filter = self.filter;
137 let admitted = history.iter().filter(|entry| filter.admits(entry));
139 let admitted = history.iter().filter(|entry| filter.admits(entry));
138 let calls = call_rows(admitted, chats, now, offset);
140 let calls = call_rows(admitted, chats, now, zone);
139 if calls.is_empty() {
141 if calls.is_empty() {
140 entries.push(ListEntry::Empty(self.filter.empty_text()));
142 entries.push(ListEntry::Empty(self.filter.empty_text()));
141 }
143 }
142 entries.extend(calls.into_iter().map(ListEntry::Call));
144 entries.extend(calls.into_iter().map(ListEntry::Call));
143 self.set_entries(entries);
145 self.set_entries(entries);
144 self.built_at = Some(BuiltAt {
146 self.built_at = Some(BuiltAt {
145 day: now.with_timezone(&offset).date_naive(),
147 day: zone.at(now).date_naive(),
146 time: now,
148 time: now,
147 });
149 });
148 self.invalidated = false;
150 self.invalidated = false;
crates/app-state/src/chat_actions.rs +2 −2
@@ -1,7 +1,7 @@
1 1 use std::future::Future;
2 2
3 3 use chatsvc::HistoryShare;
4 use chrono::{DateTime, Duration, Local, Offset, Utc};
4 use chrono::{DateTime, Duration, Utc};
5 5 use gpui_kit::*;
6 6 use store::{ChannelNotifications, ChatRecord, MemberRecord};
7 7 use teams_core::roster_event::{RosterChange, RosterEvent, SharedHistory, merge_members};
@@ -475,7 +475,7 @@ impl AppState {
475 475 expanded_lists: &self.expanded_lists,
476 476 typing: &self.typing,
477 477 now: Utc::now(),
478 offset: Local::now().offset().fix(),
478 offset: app_base::format::Zone::Local,
479 479 };
480 480 build_sections(&input)
481 481 }
@@ -1,7 +1,7 @@
1use std::future::Future;
1use std::future::Future;
2
2
3use chatsvc::HistoryShare;
3use chatsvc::HistoryShare;
4use chrono::{DateTime, Duration, Local, Offset, Utc};
4use chrono::{DateTime, Duration, Utc};
5use gpui_kit::*;
5use gpui_kit::*;
6use store::{ChannelNotifications, ChatRecord, MemberRecord};
6use store::{ChannelNotifications, ChatRecord, MemberRecord};
7use teams_core::roster_event::{RosterChange, RosterEvent, SharedHistory, merge_members};
7use teams_core::roster_event::{RosterChange, RosterEvent, SharedHistory, merge_members};
@@ -475,7 +475,7 @@ impl AppState {
475 expanded_lists: &self.expanded_lists,
475 expanded_lists: &self.expanded_lists,
476 typing: &self.typing,
476 typing: &self.typing,
477 now: Utc::now(),
477 now: Utc::now(),
478 offset: Local::now().offset().fix(),
478 offset: app_base::format::Zone::Local,
479 };
479 };
480 build_sections(&input)
480 build_sections(&input)
481 }
481 }
crates/app-state/src/chat_filter.rs +1 −1
@@ -369,7 +369,7 @@ mod tests {
369 369 expanded_lists: &expanded,
370 370 typing: &NO_TYPING,
371 371 now: Utc.with_ymd_and_hms(2026, 10, 17, 12, 0, 0).unwrap(),
372 offset: FixedOffset::east_opt(0).unwrap(),
372 offset: FixedOffset::east_opt(0).unwrap().into(),
373 373 };
374 374 let filter = ChatFilter {
375 375 text: "release".into(),
@@ -369,7 +369,7 @@ mod tests {
369 expanded_lists: &expanded,
369 expanded_lists: &expanded,
370 typing: &NO_TYPING,
370 typing: &NO_TYPING,
371 now: Utc.with_ymd_and_hms(2026, 10, 17, 12, 0, 0).unwrap(),
371 now: Utc.with_ymd_and_hms(2026, 10, 17, 12, 0, 0).unwrap(),
372 offset: FixedOffset::east_opt(0).unwrap(),
372 offset: FixedOffset::east_opt(0).unwrap().into(),
373 };
373 };
374 let filter = ChatFilter {
374 let filter = ChatFilter {
375 text: "release".into(),
375 text: "release".into(),
crates/app-state/src/sidebar_model.rs +5 −8
@@ -1,7 +1,8 @@
1 1 use std::collections::{HashMap, HashSet};
2 2
3 use app_base::format::Zone;
3 4 use app_ui_kit::widgets::Unread;
4 use chrono::{DateTime, FixedOffset, Utc};
5 use chrono::{DateTime, Utc};
5 6 use store::{
6 7 ChannelNotificationLevel, ChannelRecord, ChatRecord, MessageImportance, Sidebar, SidebarTeam,
7 8 is_bot_id,
@@ -100,7 +101,7 @@ pub struct SectionInput<'a> {
100 101 pub expanded_lists: &'a HashSet<String>,
101 102 pub typing: &'a TypingState,
102 103 pub now: DateTime<Utc>,
103 pub offset: FixedOffset,
104 pub offset: Zone,
104 105 }
105 106
106 107 pub fn preview_for(chat: &ChatRecord, me: Option<&Person>) -> Preview {
@@ -201,11 +202,7 @@ pub fn chat_item(chat: &ChatRecord, input: &SectionInput<'_>, folder_id: Option<
201 202 .preview_at
202 203 .or(chat.last_message_at)
203 204 .map(|time| {
204 format::list_time_label(
205 time,
206 input.now.with_timezone(&input.offset).date_naive(),
207 input.offset,
208 )
205 format::list_time_label(time, input.offset.at(input.now).date_naive(), input.offset)
209 206 })
210 207 .unwrap_or_default(),
211 208 preview,
@@ -806,7 +803,7 @@ mod tests {
806 803 expanded_lists: &NO_EXPANDED,
807 804 typing,
808 805 now: Utc.with_ymd_and_hms(2026, 10, 7, 12, 0, 0).unwrap(),
809 offset: FixedOffset::east_opt(0).unwrap(),
806 offset: chrono::FixedOffset::east_opt(0).unwrap().into(),
810 807 }
811 808 }
812 809
@@ -1,7 +1,8 @@
1use std::collections::{HashMap, HashSet};
1use std::collections::{HashMap, HashSet};
2
2
3use app_base::format::Zone;
3use app_ui_kit::widgets::Unread;
4use app_ui_kit::widgets::Unread;
4use chrono::{DateTime, FixedOffset, Utc};
5use chrono::{DateTime, Utc};
5use store::{
6use store::{
6 ChannelNotificationLevel, ChannelRecord, ChatRecord, MessageImportance, Sidebar, SidebarTeam,
7 ChannelNotificationLevel, ChannelRecord, ChatRecord, MessageImportance, Sidebar, SidebarTeam,
7 is_bot_id,
8 is_bot_id,
@@ -100,7 +101,7 @@ pub struct SectionInput<'a> {
100 pub expanded_lists: &'a HashSet<String>,
101 pub expanded_lists: &'a HashSet<String>,
101 pub typing: &'a TypingState,
102 pub typing: &'a TypingState,
102 pub now: DateTime<Utc>,
103 pub now: DateTime<Utc>,
103 pub offset: FixedOffset,
104 pub offset: Zone,
104}
105}
105
106
106pub fn preview_for(chat: &ChatRecord, me: Option<&Person>) -> Preview {
107pub fn preview_for(chat: &ChatRecord, me: Option<&Person>) -> Preview {
@@ -201,11 +202,7 @@ pub fn chat_item(chat: &ChatRecord, input: &SectionInput<'_>, folder_id: Option<
201 .preview_at
202 .preview_at
202 .or(chat.last_message_at)
203 .or(chat.last_message_at)
203 .map(|time| {
204 .map(|time| {
204 format::list_time_label(
205 format::list_time_label(time, input.offset.at(input.now).date_naive(), input.offset)
205 time,
206 input.now.with_timezone(&input.offset).date_naive(),
207 input.offset,
208 )
209 })
206 })
210 .unwrap_or_default(),
207 .unwrap_or_default(),
211 preview,
208 preview,
@@ -806,7 +803,7 @@ mod tests {
806 expanded_lists: &NO_EXPANDED,
803 expanded_lists: &NO_EXPANDED,
807 typing,
804 typing,
808 now: Utc.with_ymd_and_hms(2026, 10, 7, 12, 0, 0).unwrap(),
805 now: Utc.with_ymd_and_hms(2026, 10, 7, 12, 0, 0).unwrap(),
809 offset: FixedOffset::east_opt(0).unwrap(),
806 offset: chrono::FixedOffset::east_opt(0).unwrap().into(),
810 }
807 }
811 }
808 }
812
809
crates/app/src/call/overlay.rs +8 −2
@@ -107,6 +107,7 @@ pub struct CallWindows {
107 107 stage_native: Option<NativeHandle>,
108 108 stage_opening: bool,
109 109 stage_closed_by_user: bool,
110 stage_closed_call: Option<u64>,
110 111 seen_viewing: Option<bool>,
111 112 work_area: Option<WorkArea>,
112 113 minimized: bool,
@@ -186,6 +187,7 @@ impl CallWindows {
186 187 stage_native: None,
187 188 stage_opening: false,
188 189 stage_closed_by_user: false,
190 stage_closed_call: None,
189 191 seen_viewing: None,
190 192 work_area: None,
191 193 minimized: false,
@@ -297,14 +299,17 @@ impl CallWindows {
297 299
298 300 fn sync_stage(&mut self, cx: &mut Context<Self>) {
299 301 let wanted = self.stage_wanted(cx);
300 if self.stage_closed_by_user {
302 let current_call = self.app.read(cx).call.as_ref().map(|call| call.id);
303 let another_call = current_call.is_some() && current_call != self.stage_closed_call;
304 if self.stage_closed_by_user && !another_call {
301 305 if !wanted {
302 306 self.stage_closed_by_user = false;
303 } else if self.app.read(cx).call.is_none() {
307 } else if current_call.is_none() {
304 308 self.app.update(cx, |state, cx| state.dismiss_call_end(cx));
305 309 }
306 310 return;
307 311 }
312 self.stage_closed_by_user = false;
308 313 match (wanted, self.stage) {
309 314 (true, None) => self.open_stage(cx),
310 315 (false, Some(stage)) => {
@@ -315,6 +320,7 @@ impl CallWindows {
315 320 if stage.update(cx, |_, _, _| ()).is_err() {
316 321 self.forget_stage();
317 322 self.stage_closed_by_user = true;
323 self.stage_closed_call = current_call;
318 324 }
319 325 }
320 326 (false, None) => {}
@@ -107,6 +107,7 @@ pub struct CallWindows {
107 stage_native: Option<NativeHandle>,
107 stage_native: Option<NativeHandle>,
108 stage_opening: bool,
108 stage_opening: bool,
109 stage_closed_by_user: bool,
109 stage_closed_by_user: bool,
110 stage_closed_call: Option<u64>,
110 seen_viewing: Option<bool>,
111 seen_viewing: Option<bool>,
111 work_area: Option<WorkArea>,
112 work_area: Option<WorkArea>,
112 minimized: bool,
113 minimized: bool,
@@ -186,6 +187,7 @@ impl CallWindows {
186 stage_native: None,
187 stage_native: None,
187 stage_opening: false,
188 stage_opening: false,
188 stage_closed_by_user: false,
189 stage_closed_by_user: false,
190 stage_closed_call: None,
189 seen_viewing: None,
191 seen_viewing: None,
190 work_area: None,
192 work_area: None,
191 minimized: false,
193 minimized: false,
@@ -297,14 +299,17 @@ impl CallWindows {
297
299
298 fn sync_stage(&mut self, cx: &mut Context<Self>) {
300 fn sync_stage(&mut self, cx: &mut Context<Self>) {
299 let wanted = self.stage_wanted(cx);
301 let wanted = self.stage_wanted(cx);
300 if self.stage_closed_by_user {
302 let current_call = self.app.read(cx).call.as_ref().map(|call| call.id);
303 let another_call = current_call.is_some() && current_call != self.stage_closed_call;
304 if self.stage_closed_by_user && !another_call {
301 if !wanted {
305 if !wanted {
302 self.stage_closed_by_user = false;
306 self.stage_closed_by_user = false;
303 } else if self.app.read(cx).call.is_none() {
307 } else if current_call.is_none() {
304 self.app.update(cx, |state, cx| state.dismiss_call_end(cx));
308 self.app.update(cx, |state, cx| state.dismiss_call_end(cx));
305 }
309 }
306 return;
310 return;
307 }
311 }
312 self.stage_closed_by_user = false;
308 match (wanted, self.stage) {
313 match (wanted, self.stage) {
309 (true, None) => self.open_stage(cx),
314 (true, None) => self.open_stage(cx),
310 (false, Some(stage)) => {
315 (false, Some(stage)) => {
@@ -315,6 +320,7 @@ impl CallWindows {
315 if stage.update(cx, |_, _, _| ()).is_err() {
320 if stage.update(cx, |_, _, _| ()).is_err() {
316 self.forget_stage();
321 self.forget_stage();
317 self.stage_closed_by_user = true;
322 self.stage_closed_by_user = true;
323 self.stage_closed_call = current_call;
318 }
324 }
319 }
325 }
320 (false, None) => {}
326 (false, None) => {}
crates/app/src/views/quick_view_pane.rs +8 −7
@@ -1,6 +1,7 @@
1 1 use std::collections::HashMap;
2 2
3 use chrono::{DateTime, FixedOffset, Local, NaiveDate, Offset, Utc};
3 use app_base::format::Zone;
4 use chrono::{DateTime, Local, NaiveDate, Utc};
4 5 use gpui_kit::assets::IconName;
5 6 use gpui_kit::component::scroll::ScrollableElement as _;
6 7 use gpui_kit::component::{h_flex, tooltip::Tooltip, v_flex};
@@ -44,7 +45,7 @@ fn place_of(sidebar: &Sidebar, conversation_id: &str) -> Option<String> {
44 45 selection_for(sidebar, conversation_id).map(|selection| selection_title(sidebar, &selection))
45 46 }
46 47
47 fn time_label(time: DateTime<Utc>, today: NaiveDate, offset: FixedOffset) -> String {
48 fn time_label(time: DateTime<Utc>, today: NaiveDate, offset: Zone) -> String {
48 49 format::list_time_label(time, today, offset)
49 50 }
50 51
@@ -52,7 +53,7 @@ pub fn mention_rows(
52 53 entries: &[Entry],
53 54 sidebar: &Sidebar,
54 55 today: NaiveDate,
55 offset: FixedOffset,
56 offset: Zone,
56 57 ) -> Vec<QuickRow> {
57 58 let mut mentions: Vec<&Entry> = entries
58 59 .iter()
@@ -109,7 +110,7 @@ pub fn saved_rows(
109 110 items: &[SavedMessage],
110 111 sidebar: &Sidebar,
111 112 today: NaiveDate,
112 offset: FixedOffset,
113 offset: Zone,
113 114 ) -> Vec<QuickRow> {
114 115 items
115 116 .iter()
@@ -167,8 +168,8 @@ impl QuickViewPane {
167 168
168 169 fn rows(&self, view: QuickView, cx: &App) -> Vec<QuickRow> {
169 170 let state = self.app.read(cx);
170 let offset = Local::now().offset().fix();
171 let today = Utc::now().with_timezone(&offset).date_naive();
171 let offset = Zone::Local;
172 let today = Local::now().date_naive();
172 173 match view {
173 174 QuickView::Mentions => mention_rows(
174 175 self.activity.read(cx).feed().entries(),
@@ -390,7 +391,7 @@ mod tests {
390 391 entry("b", Kind::Reaction, 2),
391 392 entry("c", Kind::Mention, 3),
392 393 ];
393 let offset = FixedOffset::east_opt(0).unwrap();
394 let offset = FixedOffset::east_opt(0).unwrap().into();
394 395 let today = NaiveDate::from_ymd_opt(2026, 11, 8).unwrap();
395 396 let rows = mention_rows(&entries, &Sidebar::default(), today, offset);
396 397 let ids: Vec<_> = rows
@@ -1,6 +1,7 @@
1use std::collections::HashMap;
1use std::collections::HashMap;
2
2
3use chrono::{DateTime, FixedOffset, Local, NaiveDate, Offset, Utc};
3use app_base::format::Zone;
4use chrono::{DateTime, Local, NaiveDate, Utc};
4use gpui_kit::assets::IconName;
5use gpui_kit::assets::IconName;
5use gpui_kit::component::scroll::ScrollableElement as _;
6use gpui_kit::component::scroll::ScrollableElement as _;
6use gpui_kit::component::{h_flex, tooltip::Tooltip, v_flex};
7use gpui_kit::component::{h_flex, tooltip::Tooltip, v_flex};
@@ -44,7 +45,7 @@ fn place_of(sidebar: &Sidebar, conversation_id: &str) -> Option<String> {
44 selection_for(sidebar, conversation_id).map(|selection| selection_title(sidebar, &selection))
45 selection_for(sidebar, conversation_id).map(|selection| selection_title(sidebar, &selection))
45}
46}
46
47
47fn time_label(time: DateTime<Utc>, today: NaiveDate, offset: FixedOffset) -> String {
48fn time_label(time: DateTime<Utc>, today: NaiveDate, offset: Zone) -> String {
48 format::list_time_label(time, today, offset)
49 format::list_time_label(time, today, offset)
49}
50}
50
51
@@ -52,7 +53,7 @@ pub fn mention_rows(
52 entries: &[Entry],
53 entries: &[Entry],
53 sidebar: &Sidebar,
54 sidebar: &Sidebar,
54 today: NaiveDate,
55 today: NaiveDate,
55 offset: FixedOffset,
56 offset: Zone,
56) -> Vec<QuickRow> {
57) -> Vec<QuickRow> {
57 let mut mentions: Vec<&Entry> = entries
58 let mut mentions: Vec<&Entry> = entries
58 .iter()
59 .iter()
@@ -109,7 +110,7 @@ pub fn saved_rows(
109 items: &[SavedMessage],
110 items: &[SavedMessage],
110 sidebar: &Sidebar,
111 sidebar: &Sidebar,
111 today: NaiveDate,
112 today: NaiveDate,
112 offset: FixedOffset,
113 offset: Zone,
113) -> Vec<QuickRow> {
114) -> Vec<QuickRow> {
114 items
115 items
115 .iter()
116 .iter()
@@ -167,8 +168,8 @@ impl QuickViewPane {
167
168
168 fn rows(&self, view: QuickView, cx: &App) -> Vec<QuickRow> {
169 fn rows(&self, view: QuickView, cx: &App) -> Vec<QuickRow> {
169 let state = self.app.read(cx);
170 let state = self.app.read(cx);
170 let offset = Local::now().offset().fix();
171 let offset = Zone::Local;
171 let today = Utc::now().with_timezone(&offset).date_naive();
172 let today = Local::now().date_naive();
172 match view {
173 match view {
173 QuickView::Mentions => mention_rows(
174 QuickView::Mentions => mention_rows(
174 self.activity.read(cx).feed().entries(),
175 self.activity.read(cx).feed().entries(),
@@ -390,7 +391,7 @@ mod tests {
390 entry("b", Kind::Reaction, 2),
391 entry("b", Kind::Reaction, 2),
391 entry("c", Kind::Mention, 3),
392 entry("c", Kind::Mention, 3),
392 ];
393 ];
393 let offset = FixedOffset::east_opt(0).unwrap();
394 let offset = FixedOffset::east_opt(0).unwrap().into();
394 let today = NaiveDate::from_ymd_opt(2026, 11, 8).unwrap();
395 let today = NaiveDate::from_ymd_opt(2026, 11, 8).unwrap();
395 let rows = mention_rows(&entries, &Sidebar::default(), today, offset);
396 let rows = mention_rows(&entries, &Sidebar::default(), today, offset);
396 let ids: Vec<_> = rows
397 let ids: Vec<_> = rows
crates/app/src/views/sidebar.rs +2 −2
@@ -1,7 +1,7 @@
1 1 use std::cell::{Cell, RefCell};
2 2 use std::collections::{HashMap, HashSet};
3 3
4 use chrono::{Local, Offset, Utc};
4 use chrono::{Local, Utc};
5 5 use gpui_kit::assets::IconName;
6 6 use gpui_kit::component::button::{Button, ButtonVariants as _};
7 7 use gpui_kit::component::dialog::DialogFooter;
@@ -1163,7 +1163,7 @@ impl SidebarView {
1163 1163 let (sections, section_menus, menu, local_previews) = {
1164 1164 let state = self.state.read(cx);
1165 1165 let now = Utc::now();
1166 let offset = Local::now().offset().fix();
1166 let offset = app_base::format::Zone::Local;
1167 1167 let input = SectionInput {
1168 1168 chats: &state.sidebar.chats,
1169 1169 directory: &state.directory,
@@ -1,7 +1,7 @@
1use std::cell::{Cell, RefCell};
1use std::cell::{Cell, RefCell};
2use std::collections::{HashMap, HashSet};
2use std::collections::{HashMap, HashSet};
3
3
4use chrono::{Local, Offset, Utc};
4use chrono::{Local, Utc};
5use gpui_kit::assets::IconName;
5use gpui_kit::assets::IconName;
6use gpui_kit::component::button::{Button, ButtonVariants as _};
6use gpui_kit::component::button::{Button, ButtonVariants as _};
7use gpui_kit::component::dialog::DialogFooter;
7use gpui_kit::component::dialog::DialogFooter;
@@ -1163,7 +1163,7 @@ impl SidebarView {
1163 let (sections, section_menus, menu, local_previews) = {
1163 let (sections, section_menus, menu, local_previews) = {
1164 let state = self.state.read(cx);
1164 let state = self.state.read(cx);
1165 let now = Utc::now();
1165 let now = Utc::now();
1166 let offset = Local::now().offset().fix();
1166 let offset = app_base::format::Zone::Local;
1167 let input = SectionInput {
1167 let input = SectionInput {
1168 chats: &state.sidebar.chats,
1168 chats: &state.sidebar.chats,
1169 directory: &state.directory,
1169 directory: &state.directory,
crates/app/src/views/switcher.rs +4 −4
@@ -8,7 +8,7 @@ use std::collections::{HashMap, HashSet};
8 8 use std::ops::Range;
9 9 use std::time::Duration;
10 10
11 use chrono::{Local, Offset};
11 use chrono::Local;
12 12 use gpui_kit::prelude::FluentBuilder as _;
13 13 use gpui_kit::*;
14 14 use store::SearchHit;
@@ -86,7 +86,7 @@ pub fn message_results(
86 86 hits: Vec<SearchHit>,
87 87 conversations: &HashMap<String, (String, Selection)>,
88 88 today: chrono::NaiveDate,
89 offset: chrono::FixedOffset,
89 offset: app_base::format::Zone,
90 90 ) -> Vec<MessageResult> {
91 91 hits.into_iter()
92 92 .filter_map(|hit| {
@@ -272,7 +272,7 @@ impl Switcher {
272 272 hits,
273 273 &self.conversations,
274 274 now.date_naive(),
275 now.offset().fix(),
275 app_base::format::Zone::Local,
276 276 )
277 277 } else {
278 278 Vec::new()
@@ -348,7 +348,7 @@ impl Switcher {
348 348 &suggestions.messages,
349 349 &self.conversations,
350 350 now.date_naive(),
351 now.offset().fix(),
351 app_base::format::Zone::Local,
352 352 );
353 353 self.messages = merge_messages(&self.local_messages, server, MAX_MESSAGE_RESULTS);
354 354 let held_position = held_message.and_then(|message_id| {
@@ -8,7 +8,7 @@ use std::collections::{HashMap, HashSet};
8use std::ops::Range;
8use std::ops::Range;
9use std::time::Duration;
9use std::time::Duration;
10
10
11use chrono::{Local, Offset};
11use chrono::Local;
12use gpui_kit::prelude::FluentBuilder as _;
12use gpui_kit::prelude::FluentBuilder as _;
13use gpui_kit::*;
13use gpui_kit::*;
14use store::SearchHit;
14use store::SearchHit;
@@ -86,7 +86,7 @@ pub fn message_results(
86 hits: Vec<SearchHit>,
86 hits: Vec<SearchHit>,
87 conversations: &HashMap<String, (String, Selection)>,
87 conversations: &HashMap<String, (String, Selection)>,
88 today: chrono::NaiveDate,
88 today: chrono::NaiveDate,
89 offset: chrono::FixedOffset,
89 offset: app_base::format::Zone,
90) -> Vec<MessageResult> {
90) -> Vec<MessageResult> {
91 hits.into_iter()
91 hits.into_iter()
92 .filter_map(|hit| {
92 .filter_map(|hit| {
@@ -272,7 +272,7 @@ impl Switcher {
272 hits,
272 hits,
273 &self.conversations,
273 &self.conversations,
274 now.date_naive(),
274 now.date_naive(),
275 now.offset().fix(),
275 app_base::format::Zone::Local,
276 )
276 )
277 } else {
277 } else {
278 Vec::new()
278 Vec::new()
@@ -348,7 +348,7 @@ impl Switcher {
348 &suggestions.messages,
348 &suggestions.messages,
349 &self.conversations,
349 &self.conversations,
350 now.date_naive(),
350 now.date_naive(),
351 now.offset().fix(),
351 app_base::format::Zone::Local,
352 );
352 );
353 self.messages = merge_messages(&self.local_messages, server, MAX_MESSAGE_RESULTS);
353 self.messages = merge_messages(&self.local_messages, server, MAX_MESSAGE_RESULTS);
354 let held_position = held_message.and_then(|message_id| {
354 let held_position = held_message.and_then(|message_id| {
crates/app/src/views/switcher_server.rs +3 −3
@@ -1,6 +1,6 @@
1 1 use std::collections::{HashMap, HashSet};
2 2
3 use chrono::{FixedOffset, NaiveDate};
3 use chrono::NaiveDate;
4 4 use teams_core::substrate_search::{SearchMessage, SearchPerson, split_highlights};
5 5
6 6 use super::switcher::MessageResult;
@@ -46,7 +46,7 @@ pub fn server_message_results(
46 46 messages: &[SearchMessage],
47 47 conversations: &HashMap<String, (String, Selection)>,
48 48 today: NaiveDate,
49 offset: FixedOffset,
49 offset: app_base::format::Zone,
50 50 ) -> Vec<MessageResult> {
51 51 messages
52 52 .iter()
@@ -161,7 +161,7 @@ mod tests {
161 161 ..SearchMessage::default()
162 162 };
163 163 let today = NaiveDate::from_ymd_opt(2026, 11, 8).unwrap();
164 let offset = FixedOffset::east_opt(0).unwrap();
164 let offset = chrono::FixedOffset::east_opt(0).unwrap().into();
165 165 let results = server_message_results(
166 166 &[hit("19:a"), hit("19:unknown")],
167 167 &conversations,
@@ -1,6 +1,6 @@
1use std::collections::{HashMap, HashSet};
1use std::collections::{HashMap, HashSet};
2
2
3use chrono::{FixedOffset, NaiveDate};
3use chrono::NaiveDate;
4use teams_core::substrate_search::{SearchMessage, SearchPerson, split_highlights};
4use teams_core::substrate_search::{SearchMessage, SearchPerson, split_highlights};
5
5
6use super::switcher::MessageResult;
6use super::switcher::MessageResult;
@@ -46,7 +46,7 @@ pub fn server_message_results(
46 messages: &[SearchMessage],
46 messages: &[SearchMessage],
47 conversations: &HashMap<String, (String, Selection)>,
47 conversations: &HashMap<String, (String, Selection)>,
48 today: NaiveDate,
48 today: NaiveDate,
49 offset: FixedOffset,
49 offset: app_base::format::Zone,
50) -> Vec<MessageResult> {
50) -> Vec<MessageResult> {
51 messages
51 messages
52 .iter()
52 .iter()
@@ -161,7 +161,7 @@ mod tests {
161 ..SearchMessage::default()
161 ..SearchMessage::default()
162 };
162 };
163 let today = NaiveDate::from_ymd_opt(2026, 11, 8).unwrap();
163 let today = NaiveDate::from_ymd_opt(2026, 11, 8).unwrap();
164 let offset = FixedOffset::east_opt(0).unwrap();
164 let offset = chrono::FixedOffset::east_opt(0).unwrap().into();
165 let results = server_message_results(
165 let results = server_message_results(
166 &[hit("19:a"), hit("19:unknown")],
166 &[hit("19:a"), hit("19:unknown")],
167 &conversations,
167 &conversations,
crates/calling/src/blur.rs +18 −4
@@ -75,9 +75,18 @@ pub struct BlurSettings {
75 75 effects: Mutex<CameraEffects>,
76 76 cutout: Mutex<Option<Arc<Cutout>>>,
77 77 model: Mutex<&'static str>,
78 unavailable: AtomicBool,
78 79 }
79 80
80 81 impl BlurSettings {
82 pub fn mark_unavailable(&self) {
83 self.unavailable.store(true, Ordering::Relaxed);
84 }
85
86 pub fn take_unavailable(&self) -> bool {
87 self.unavailable.swap(false, Ordering::Relaxed)
88 }
89
81 90 pub fn set_enabled(&self, enabled: bool) {
82 91 self.enabled.store(enabled, Ordering::Relaxed);
83 92 }
@@ -214,6 +223,7 @@ struct WorkerShared {
214 223 outbox: Mutex<Outbox>,
215 224 stride: AtomicU64,
216 225 model: Mutex<&'static str>,
226 failed: AtomicBool,
217 227 }
218 228
219 229 fn stride_for(inference: Duration) -> u64 {
@@ -294,14 +304,14 @@ impl MaskSource {
294 304 outbox: Mutex::default(),
295 305 stride: AtomicU64::new(1),
296 306 model: Mutex::new(""),
307 failed: AtomicBool::new(false),
297 308 });
298 309 let worker_shared = shared.clone();
299 310 let worker = std::thread::Builder::new()
300 311 .name("segmentation".to_owned())
301 .spawn(move || {
302 if let Some(mut inference) = create() {
303 run_worker(&worker_shared, &mut inference);
304 }
312 .spawn(move || match create() {
313 Some(mut inference) => run_worker(&worker_shared, &mut inference),
314 None => worker_shared.failed.store(true, Ordering::Relaxed),
305 315 })
306 316 .expect("segmentation thread");
307 317 MaskSource {
@@ -325,6 +335,10 @@ impl MaskSource {
325 335 &self.mask
326 336 }
327 337
338 pub fn failed(&self) -> bool {
339 self.shared.failed.load(Ordering::Relaxed)
340 }
341
328 342 /// The model that made the newest mask, empty until the first one.
329 343 pub fn model(&self) -> &'static str {
330 344 *self.shared.model.lock().expect("model lock")
@@ -75,9 +75,18 @@ pub struct BlurSettings {
75 effects: Mutex<CameraEffects>,
75 effects: Mutex<CameraEffects>,
76 cutout: Mutex<Option<Arc<Cutout>>>,
76 cutout: Mutex<Option<Arc<Cutout>>>,
77 model: Mutex<&'static str>,
77 model: Mutex<&'static str>,
78 unavailable: AtomicBool,
78}
79}
79
80
80impl BlurSettings {
81impl BlurSettings {
82 pub fn mark_unavailable(&self) {
83 self.unavailable.store(true, Ordering::Relaxed);
84 }
85
86 pub fn take_unavailable(&self) -> bool {
87 self.unavailable.swap(false, Ordering::Relaxed)
88 }
89
81 pub fn set_enabled(&self, enabled: bool) {
90 pub fn set_enabled(&self, enabled: bool) {
82 self.enabled.store(enabled, Ordering::Relaxed);
91 self.enabled.store(enabled, Ordering::Relaxed);
83 }
92 }
@@ -214,6 +223,7 @@ struct WorkerShared {
214 outbox: Mutex<Outbox>,
223 outbox: Mutex<Outbox>,
215 stride: AtomicU64,
224 stride: AtomicU64,
216 model: Mutex<&'static str>,
225 model: Mutex<&'static str>,
226 failed: AtomicBool,
217}
227}
218
228
219fn stride_for(inference: Duration) -> u64 {
229fn stride_for(inference: Duration) -> u64 {
@@ -294,14 +304,14 @@ impl MaskSource {
294 outbox: Mutex::default(),
304 outbox: Mutex::default(),
295 stride: AtomicU64::new(1),
305 stride: AtomicU64::new(1),
296 model: Mutex::new(""),
306 model: Mutex::new(""),
307 failed: AtomicBool::new(false),
297 });
308 });
298 let worker_shared = shared.clone();
309 let worker_shared = shared.clone();
299 let worker = std::thread::Builder::new()
310 let worker = std::thread::Builder::new()
300 .name("segmentation".to_owned())
311 .name("segmentation".to_owned())
301 .spawn(move || {
312 .spawn(move || match create() {
302 if let Some(mut inference) = create() {
313 Some(mut inference) => run_worker(&worker_shared, &mut inference),
303 run_worker(&worker_shared, &mut inference);
314 None => worker_shared.failed.store(true, Ordering::Relaxed),
304 }
305 })
315 })
306 .expect("segmentation thread");
316 .expect("segmentation thread");
307 MaskSource {
317 MaskSource {
@@ -325,6 +335,10 @@ impl MaskSource {
325 &self.mask
335 &self.mask
326 }
336 }
327
337
338 pub fn failed(&self) -> bool {
339 self.shared.failed.load(Ordering::Relaxed)
340 }
341
328 /// The model that made the newest mask, empty until the first one.
342 /// The model that made the newest mask, empty until the first one.
329 pub fn model(&self) -> &'static str {
343 pub fn model(&self) -> &'static str {
330 *self.shared.model.lock().expect("model lock")
344 *self.shared.model.lock().expect("model lock")
crates/calling/src/call.rs +35 −6
@@ -110,6 +110,10 @@ const STATS_PERIOD: Duration = Duration::from_millis(200);
110 110 const TICKS_PER_SECOND: u32 = 5;
111 111 const RECONNECT_WINDOW: Duration = Duration::from_secs(30);
112 112 const OUTGOING_TIMEOUT: Duration = Duration::from_secs(90);
113 const BROKER_IDLE_WAIT: Duration = Duration::from_millis(500);
114 const BROKER_RETRY_WAIT: Duration = Duration::from_secs(3);
115 const CAMERA_EFFECTS_FAILED_NOTICE: &str =
116 "Background effects could not start, your camera is sent without them";
113 117 const SETUP_STEP_TIMEOUT: Duration = Duration::from_secs(30);
114 118 const DIRECT_OUTGOING_TIMEOUT: Duration = Duration::from_secs(185);
115 119 const FAR_FUTURE: Duration = Duration::from_secs(60 * 60 * 24 * 365);
@@ -513,6 +517,13 @@ impl CallEngine {
513 517 match control.until_hangup(inner.gate.lock()).await {
514 518 Ok(guard) => Some(guard),
515 519 Err(_) => {
520 if let Plan::Incoming(incoming) = &plan {
521 inner.unregister_route(incoming.links.call_id());
522 if let Some(call_leg) = incoming.attached.links.get("callLeg") {
523 let signaling = inner.signaling(Timeline::new(options.trace));
524 let _ = signaling.decline(call_leg).await;
525 }
526 }
516 527 let mut state = CallState::Idle;
517 528 advance(&mut state, CallSignal::Dial, &control);
518 529 advance(&mut state, CallSignal::LocalLeave, &control);
@@ -1229,8 +1240,9 @@ async fn drive(
1229 1240 let modalities = accepted_modalities(
1230 1241 matches!(video_answer, AnswerVideo::Send(_)) && answered.camera_mid.is_some(),
1231 1242 );
1232 let acknowledged = signaling
1233 .accept(
1243 let acknowledged = setup_step(
1244 control,
1245 signaling.accept(
1234 1246 acceptance_url,
1235 1247 &Answer {
1236 1248 from: &participant,
@@ -1239,8 +1251,9 @@ async fn drive(
1239 1251 callbacks: &links,
1240 1252 modalities: &modalities,
1241 1253 },
1242 )
1243 .await?;
1254 ),
1255 )
1256 .await?;
1244 1257 negotiator.answered_incoming(attached.from_mixer);
1245 1258 remote_set = true;
1246 1259 media_links.extend(attached.links.clone());
@@ -1440,6 +1453,10 @@ async fn drive(
1440 1453 }
1441 1454 let old = std::mem::replace(&mut current, pending.session);
1442 1455 old.peer.close();
1456 reconnect_deadline = None;
1457 if callee_gate.media_connected() {
1458 advance(state, CallSignal::MediaConnected, control);
1459 }
1443 1460 if let Some(audio) = &software_audio
1444 1461 && let Err(error) = swap_audio_track(&current.peer, &audio.track)
1445 1462 {
@@ -2116,6 +2133,11 @@ async fn drive(
2116 2133 reconnect_deadline = Some(Instant::now() + options.reconnect_window);
2117 2134 }
2118 2135 }
2136 PeerConnectionState::Failed if next.is_some() => {
2137 if advance(state, CallSignal::MediaDisconnected, control) {
2138 reconnect_deadline = Some(Instant::now() + options.reconnect_window);
2139 }
2140 }
2119 2141 PeerConnectionState::Failed => {
2120 2142 advance(state, CallSignal::MediaFailed, control);
2121 2143 break;
@@ -2757,6 +2779,10 @@ async fn drive(
2757 2779 }
2758 2780 },
2759 2781 _ = stats_tick.tick(), if remote_set => {
2782 if local_video.take_effects_failure() {
2783 timeline.record("camera effects failed", "segmentation model did not load");
2784 control.send(CallUpdate::Notice(CAMERA_EFFECTS_FAILED_NOTICE.into()));
2785 }
2760 2786 let speaking = active_speakers::speaking_sources(&active_speakers::audio_sources(&current.peer));
2761 2787 if speaking != speaking_sources {
2762 2788 if speaking_sources.is_empty() && !speaker_sources_seen {
@@ -4205,6 +4231,9 @@ fn sync_software_audio(
4205 4231 timeline.record("computer sound warning", warning.clone());
4206 4232 }
4207 4233 control.send(CallUpdate::ShareSound(plan.computer_sound));
4234 if let Some(notice) = audio.microphone_notice {
4235 control.send(CallUpdate::Notice(notice.into()));
4236 }
4208 4237 *software_audio = Some(audio);
4209 4238 }
4210 4239 Err(error) => {
@@ -4436,8 +4465,8 @@ async fn poll_broker(
4436 4465 while running.load(Ordering::SeqCst) {
4437 4466 match signaling.poll_broker(&url).await {
4438 4467 Ok(Some(next)) => url = next,
4439 Ok(None) => {}
4440 Err(_) => return,
4468 Ok(None) => tokio::time::sleep(BROKER_IDLE_WAIT).await,
4469 Err(_) => tokio::time::sleep(BROKER_RETRY_WAIT).await,
4441 4470 }
4442 4471 }
4443 4472 }
@@ -110,6 +110,10 @@ const STATS_PERIOD: Duration = Duration::from_millis(200);
110const TICKS_PER_SECOND: u32 = 5;
110const TICKS_PER_SECOND: u32 = 5;
111const RECONNECT_WINDOW: Duration = Duration::from_secs(30);
111const RECONNECT_WINDOW: Duration = Duration::from_secs(30);
112const OUTGOING_TIMEOUT: Duration = Duration::from_secs(90);
112const OUTGOING_TIMEOUT: Duration = Duration::from_secs(90);
113const BROKER_IDLE_WAIT: Duration = Duration::from_millis(500);
114const BROKER_RETRY_WAIT: Duration = Duration::from_secs(3);
115const CAMERA_EFFECTS_FAILED_NOTICE: &str =
116 "Background effects could not start, your camera is sent without them";
113const SETUP_STEP_TIMEOUT: Duration = Duration::from_secs(30);
117const SETUP_STEP_TIMEOUT: Duration = Duration::from_secs(30);
114const DIRECT_OUTGOING_TIMEOUT: Duration = Duration::from_secs(185);
118const DIRECT_OUTGOING_TIMEOUT: Duration = Duration::from_secs(185);
115const FAR_FUTURE: Duration = Duration::from_secs(60 * 60 * 24 * 365);
119const FAR_FUTURE: Duration = Duration::from_secs(60 * 60 * 24 * 365);
@@ -513,6 +517,13 @@ impl CallEngine {
513 match control.until_hangup(inner.gate.lock()).await {
517 match control.until_hangup(inner.gate.lock()).await {
514 Ok(guard) => Some(guard),
518 Ok(guard) => Some(guard),
515 Err(_) => {
519 Err(_) => {
520 if let Plan::Incoming(incoming) = &plan {
521 inner.unregister_route(incoming.links.call_id());
522 if let Some(call_leg) = incoming.attached.links.get("callLeg") {
523 let signaling = inner.signaling(Timeline::new(options.trace));
524 let _ = signaling.decline(call_leg).await;
525 }
526 }
516 let mut state = CallState::Idle;
527 let mut state = CallState::Idle;
517 advance(&mut state, CallSignal::Dial, &control);
528 advance(&mut state, CallSignal::Dial, &control);
518 advance(&mut state, CallSignal::LocalLeave, &control);
529 advance(&mut state, CallSignal::LocalLeave, &control);
@@ -1229,8 +1240,9 @@ async fn drive(
1229 let modalities = accepted_modalities(
1240 let modalities = accepted_modalities(
1230 matches!(video_answer, AnswerVideo::Send(_)) && answered.camera_mid.is_some(),
1241 matches!(video_answer, AnswerVideo::Send(_)) && answered.camera_mid.is_some(),
1231 );
1242 );
1232 let acknowledged = signaling
1243 let acknowledged = setup_step(
1233 .accept(
1244 control,
1245 signaling.accept(
1234 acceptance_url,
1246 acceptance_url,
1235 &Answer {
1247 &Answer {
1236 from: &participant,
1248 from: &participant,
@@ -1239,8 +1251,9 @@ async fn drive(
1239 callbacks: &links,
1251 callbacks: &links,
1240 modalities: &modalities,
1252 modalities: &modalities,
1241 },
1253 },
1242 )
1254 ),
1243 .await?;
1255 )
1256 .await?;
1244 negotiator.answered_incoming(attached.from_mixer);
1257 negotiator.answered_incoming(attached.from_mixer);
1245 remote_set = true;
1258 remote_set = true;
1246 media_links.extend(attached.links.clone());
1259 media_links.extend(attached.links.clone());
@@ -1440,6 +1453,10 @@ async fn drive(
1440 }
1453 }
1441 let old = std::mem::replace(&mut current, pending.session);
1454 let old = std::mem::replace(&mut current, pending.session);
1442 old.peer.close();
1455 old.peer.close();
1456 reconnect_deadline = None;
1457 if callee_gate.media_connected() {
1458 advance(state, CallSignal::MediaConnected, control);
1459 }
1443 if let Some(audio) = &software_audio
1460 if let Some(audio) = &software_audio
1444 && let Err(error) = swap_audio_track(&current.peer, &audio.track)
1461 && let Err(error) = swap_audio_track(&current.peer, &audio.track)
1445 {
1462 {
@@ -2116,6 +2133,11 @@ async fn drive(
2116 reconnect_deadline = Some(Instant::now() + options.reconnect_window);
2133 reconnect_deadline = Some(Instant::now() + options.reconnect_window);
2117 }
2134 }
2118 }
2135 }
2136 PeerConnectionState::Failed if next.is_some() => {
2137 if advance(state, CallSignal::MediaDisconnected, control) {
2138 reconnect_deadline = Some(Instant::now() + options.reconnect_window);
2139 }
2140 }
2119 PeerConnectionState::Failed => {
2141 PeerConnectionState::Failed => {
2120 advance(state, CallSignal::MediaFailed, control);
2142 advance(state, CallSignal::MediaFailed, control);
2121 break;
2143 break;
@@ -2757,6 +2779,10 @@ async fn drive(
2757 }
2779 }
2758 },
2780 },
2759 _ = stats_tick.tick(), if remote_set => {
2781 _ = stats_tick.tick(), if remote_set => {
2782 if local_video.take_effects_failure() {
2783 timeline.record("camera effects failed", "segmentation model did not load");
2784 control.send(CallUpdate::Notice(CAMERA_EFFECTS_FAILED_NOTICE.into()));
2785 }
2760 let speaking = active_speakers::speaking_sources(&active_speakers::audio_sources(&current.peer));
2786 let speaking = active_speakers::speaking_sources(&active_speakers::audio_sources(&current.peer));
2761 if speaking != speaking_sources {
2787 if speaking != speaking_sources {
2762 if speaking_sources.is_empty() && !speaker_sources_seen {
2788 if speaking_sources.is_empty() && !speaker_sources_seen {
@@ -4205,6 +4231,9 @@ fn sync_software_audio(
4205 timeline.record("computer sound warning", warning.clone());
4231 timeline.record("computer sound warning", warning.clone());
4206 }
4232 }
4207 control.send(CallUpdate::ShareSound(plan.computer_sound));
4233 control.send(CallUpdate::ShareSound(plan.computer_sound));
4234 if let Some(notice) = audio.microphone_notice {
4235 control.send(CallUpdate::Notice(notice.into()));
4236 }
4208 *software_audio = Some(audio);
4237 *software_audio = Some(audio);
4209 }
4238 }
4210 Err(error) => {
4239 Err(error) => {
@@ -4436,8 +4465,8 @@ async fn poll_broker(
4436 while running.load(Ordering::SeqCst) {
4465 while running.load(Ordering::SeqCst) {
4437 match signaling.poll_broker(&url).await {
4466 match signaling.poll_broker(&url).await {
4438 Ok(Some(next)) => url = next,
4467 Ok(Some(next)) => url = next,
4439 Ok(None) => {}
4468 Ok(None) => tokio::time::sleep(BROKER_IDLE_WAIT).await,
4440 Err(_) => return,
4469 Err(_) => tokio::time::sleep(BROKER_RETRY_WAIT).await,
4441 }
4470 }
4442 }
4471 }
4443}
4472}
crates/calling/src/effects.rs +5 −0
@@ -171,6 +171,11 @@ impl EffectsStage {
171 171 Err(_) => self.unavailable = true,
172 172 }
173 173 }
174 if !self.unavailable && self.masks.as_ref().is_some_and(MaskSource::failed) {
175 self.unavailable = true;
176 self.masks = None;
177 self.settings.mark_unavailable();
178 }
174 179 !self.unavailable
175 180 }
176 181
@@ -171,6 +171,11 @@ impl EffectsStage {
171 Err(_) => self.unavailable = true,
171 Err(_) => self.unavailable = true,
172 }
172 }
173 }
173 }
174 if !self.unavailable && self.masks.as_ref().is_some_and(MaskSource::failed) {
175 self.unavailable = true;
176 self.masks = None;
177 self.settings.mark_unavailable();
178 }
174 !self.unavailable
179 !self.unavailable
175 }
180 }
176
181
crates/calling/src/engine.rs +8 −0
@@ -598,6 +598,14 @@ async fn ring_task(
598 598 }
599 599 }
600 600 command = commands.recv() => match command {
601 Some(RingCommand::Accept(_, answer)) if answer.is_closed() => {
602 if let Some(call_leg) = attached.links.get("callLeg")
603 && let Err(error) = signaling.decline(call_leg).await
604 {
605 timeline.record("decline failed", error.to_string());
606 }
607 break;
608 }
601 609 Some(RingCommand::Accept(accept, answer)) => {
602 610 let (handle, control) = call_channel();
603 611 let incoming = IncomingCall {
@@ -598,6 +598,14 @@ async fn ring_task(
598 }
598 }
599 }
599 }
600 command = commands.recv() => match command {
600 command = commands.recv() => match command {
601 Some(RingCommand::Accept(_, answer)) if answer.is_closed() => {
602 if let Some(call_leg) = attached.links.get("callLeg")
603 && let Err(error) = signaling.decline(call_leg).await
604 {
605 timeline.record("decline failed", error.to_string());
606 }
607 break;
608 }
601 Some(RingCommand::Accept(accept, answer)) => {
609 Some(RingCommand::Accept(accept, answer)) => {
602 let (handle, control) = call_channel();
610 let (handle, control) = call_channel();
603 let incoming = IncomingCall {
611 let incoming = IncomingCall {
crates/calling/src/software_audio.rs +31 −4
@@ -105,6 +105,11 @@ impl Feeder {
105 105 }
106 106 }
107 107
108 const DEFAULT_MICROPHONE_NOTICE: &str =
109 "The picked microphone could not be captured while sharing sound, using the default one";
110 const NO_MICROPHONE_NOTICE: &str =
111 "The microphone could not be captured while sharing sound, others cannot hear you";
112
108 113 /// Mic through our own processing, plus computer sound when planned, as one track that replaces the device track.
109 114 pub struct SoftwareAudio {
110 115 pub track: RtcAudioTrack,
@@ -112,6 +117,7 @@ pub struct SoftwareAudio {
112 117 pub loopback: Option<LoopbackKind>,
113 118 pub warning: Option<String>,
114 119 pub microphone_source: Option<String>,
120 pub microphone_notice: Option<&'static str>,
115 121 microphone_muted: Arc<AtomicBool>,
116 122 running: Arc<AtomicBool>,
117 123 feeder: Option<std::thread::JoinHandle<()>>,
@@ -153,6 +159,7 @@ impl SoftwareAudio {
153 159 let mut captures = Vec::new();
154 160 let mut warning = None;
155 161 let mut microphone_source = None;
162 let mut microphone_notice = None;
156 163 let (microphone, computer, loopback) = if mode == AudioMode::Platform {
157 164 let computer_queue = SampleQueue::default();
158 165 let (computer, loopback) = if plan.computer_sound {
@@ -174,10 +181,29 @@ impl SoftwareAudio {
174 181 if !plan.computer_sound {
175 182 return Err(error);
176 183 }
177 warning.get_or_insert(format!(
178 "microphone not captured while sharing sound: {error}"
179 ));
180 FrameSource::Silence
184 let fallback_queue = SampleQueue::default();
185 let fallback = Some(input)
186 .filter(|input| **input != DeviceChoice::SystemDefault)
187 .and_then(|_| {
188 start_microphone(&DeviceChoice::SystemDefault, fallback_queue.clone())
189 .ok()
190 });
191 match fallback {
192 Some(started) => {
193 microphone_notice = Some(DEFAULT_MICROPHONE_NOTICE);
194 microphone_source =
195 Some(format!("{}, picked one failed: {error}", started.source));
196 captures.push(started.capture);
197 FrameSource::Captured(fallback_queue)
198 }
199 None => {
200 microphone_notice = Some(NO_MICROPHONE_NOTICE);
201 warning.get_or_insert(format!(
202 "microphone not captured while sharing sound: {error}"
203 ));
204 FrameSource::Silence
205 }
206 }
181 207 }
182 208 };
183 209 (microphone, computer, loopback)
@@ -230,6 +256,7 @@ impl SoftwareAudio {
230 256 loopback,
231 257 warning,
232 258 microphone_source,
259 microphone_notice,
233 260 microphone_muted,
234 261 running,
235 262 feeder: Some(thread),
@@ -105,6 +105,11 @@ impl Feeder {
105 }
105 }
106}
106}
107
107
108const DEFAULT_MICROPHONE_NOTICE: &str =
109 "The picked microphone could not be captured while sharing sound, using the default one";
110const NO_MICROPHONE_NOTICE: &str =
111 "The microphone could not be captured while sharing sound, others cannot hear you";
112
108/// Mic through our own processing, plus computer sound when planned, as one track that replaces the device track.
113/// Mic through our own processing, plus computer sound when planned, as one track that replaces the device track.
109pub struct SoftwareAudio {
114pub struct SoftwareAudio {
110 pub track: RtcAudioTrack,
115 pub track: RtcAudioTrack,
@@ -112,6 +117,7 @@ pub struct SoftwareAudio {
112 pub loopback: Option<LoopbackKind>,
117 pub loopback: Option<LoopbackKind>,
113 pub warning: Option<String>,
118 pub warning: Option<String>,
114 pub microphone_source: Option<String>,
119 pub microphone_source: Option<String>,
120 pub microphone_notice: Option<&'static str>,
115 microphone_muted: Arc<AtomicBool>,
121 microphone_muted: Arc<AtomicBool>,
116 running: Arc<AtomicBool>,
122 running: Arc<AtomicBool>,
117 feeder: Option<std::thread::JoinHandle<()>>,
123 feeder: Option<std::thread::JoinHandle<()>>,
@@ -153,6 +159,7 @@ impl SoftwareAudio {
153 let mut captures = Vec::new();
159 let mut captures = Vec::new();
154 let mut warning = None;
160 let mut warning = None;
155 let mut microphone_source = None;
161 let mut microphone_source = None;
162 let mut microphone_notice = None;
156 let (microphone, computer, loopback) = if mode == AudioMode::Platform {
163 let (microphone, computer, loopback) = if mode == AudioMode::Platform {
157 let computer_queue = SampleQueue::default();
164 let computer_queue = SampleQueue::default();
158 let (computer, loopback) = if plan.computer_sound {
165 let (computer, loopback) = if plan.computer_sound {
@@ -174,10 +181,29 @@ impl SoftwareAudio {
174 if !plan.computer_sound {
181 if !plan.computer_sound {
175 return Err(error);
182 return Err(error);
176 }
183 }
177 warning.get_or_insert(format!(
184 let fallback_queue = SampleQueue::default();
178 "microphone not captured while sharing sound: {error}"
185 let fallback = Some(input)
179 ));
186 .filter(|input| **input != DeviceChoice::SystemDefault)
180 FrameSource::Silence
187 .and_then(|_| {
188 start_microphone(&DeviceChoice::SystemDefault, fallback_queue.clone())
189 .ok()
190 });
191 match fallback {
192 Some(started) => {
193 microphone_notice = Some(DEFAULT_MICROPHONE_NOTICE);
194 microphone_source =
195 Some(format!("{}, picked one failed: {error}", started.source));
196 captures.push(started.capture);
197 FrameSource::Captured(fallback_queue)
198 }
199 None => {
200 microphone_notice = Some(NO_MICROPHONE_NOTICE);
201 warning.get_or_insert(format!(
202 "microphone not captured while sharing sound: {error}"
203 ));
204 FrameSource::Silence
205 }
206 }
181 }
207 }
182 };
208 };
183 (microphone, computer, loopback)
209 (microphone, computer, loopback)
@@ -230,6 +256,7 @@ impl SoftwareAudio {
230 loopback,
256 loopback,
231 warning,
257 warning,
232 microphone_source,
258 microphone_source,
259 microphone_notice,
233 microphone_muted,
260 microphone_muted,
234 running,
261 running,
235 feeder: Some(thread),
262 feeder: Some(thread),
crates/calling/src/video_send.rs +4 −0
@@ -437,6 +437,10 @@ impl LocalVideo {
437 437 self.camera.track.clone()
438 438 }
439 439
440 pub fn take_effects_failure(&self) -> bool {
441 self.blur.take_unavailable()
442 }
443
440 444 pub fn blur_average_ms(&self) -> Option<f32> {
441 445 (self.camera_on() && self.blur.active()).then(|| self.blur.average_ms())
442 446 }
@@ -437,6 +437,10 @@ impl LocalVideo {
437 self.camera.track.clone()
437 self.camera.track.clone()
438 }
438 }
439
439
440 pub fn take_effects_failure(&self) -> bool {
441 self.blur.take_unavailable()
442 }
443
440 pub fn blur_average_ms(&self) -> Option<f32> {
444 pub fn blur_average_ms(&self) -> Option<f32> {
441 (self.camera_on() && self.blur.active()).then(|| self.blur.average_ms())
445 (self.camera_on() && self.blur.active()).then(|| self.blur.average_ms())
442 }
446 }