BlueGit

ict rusty-teams

fix(calls): outgoing calls ring until answered, video in mixer 1:1 calls, mic device menu, video call button

- Outgoing person calls stay Calling with ringback until the callee is in the roster (or answers P2P). The mixer accepts our own leg at once, which started the timer early. The no-answer timeout keeps running until then.
- A 1:1 call answered by the mixer escalates to a conference peer connection right away, as Teams web does. Camera on in a 1:1 call still on the mixer showed nothing and the server ended the call (updateMediaDescriptions 400, code 1047); now it is refused with a notice until the escalation is done.
- Chat header: video call button next to the phone; the call starts with the camera on once video is possible.
- Call bar: mic and speaker choice moved into a chevron menu on the mic, like the camera; the separate speaker button is gone.

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

metis Daniel Däschle · pushed by metis

Authored 2026-10-12 · 7 weeks ago

Hash
2cdaab9ddf6dbc84a15d4cd949cfc7a12d950b70
Parent
0958d7a2
13 files changed +323 −93
crates/app/src/call/actions.rs +24 −3
@@ -67,13 +67,26 @@ impl AppState {
67 67 self.show_call(true, cx);
68 68 return;
69 69 }
70 let Some(handle) = self.place_call(CallSpec::Echo, DemoCall::Test, cx) else {
70 let Some(handle) = self.place_call(CallSpec::Echo, DemoCall::Test, false, cx) else {
71 71 return;
72 72 };
73 73 self.begin_call(handle, CallModel::test(), None, cx);
74 74 }
75 75
76 76 pub fn start_chat_call(&mut self, conversation_id: &str, cx: &mut Context<Self>) {
77 self.start_chat_call_with(conversation_id, false, cx);
78 }
79
80 pub fn start_chat_video_call(&mut self, conversation_id: &str, cx: &mut Context<Self>) {
81 self.start_chat_call_with(conversation_id, true, cx);
82 }
83
84 fn start_chat_call_with(
85 &mut self,
86 conversation_id: &str,
87 with_video: bool,
88 cx: &mut Context<Self>,
89 ) {
77 90 if self.call.is_some() {
78 91 self.show_call(true, cx);
79 92 return;
@@ -99,7 +112,9 @@ impl AppState {
99 112 .collect(),
100 113 thread_id: conversation_id.to_owned(),
101 114 };
102 let Some(handle) = self.place_call(spec, DemoCall::People(plan.callees.clone()), cx) else {
115 let Some(handle) =
116 self.place_call(spec, DemoCall::People(plan.callees.clone()), with_video, cx)
117 else {
103 118 return;
104 119 };
105 120 let user_ids = plan
@@ -110,6 +125,9 @@ impl AppState {
110 125 self.request_avatars(user_ids, cx);
111 126 let model = CallModel::people(&plan.title, &plan.callees);
112 127 self.begin_call(handle, model, Some(conversation_id.to_owned()), cx);
128 if with_video && self.mode.demo {
129 self.send_call_command(CallCommand::SetCamera(true));
130 }
113 131 }
114 132
115 133 pub fn join_meeting_call(&mut self, conversation_id: &str, cx: &mut Context<Self>) {
@@ -135,7 +153,8 @@ impl AppState {
135 153 lobby: conversation_id == DEMO_LOBBY_MEETING,
136 154 organizer: conversation_id != DEMO_LOBBY_MEETING,
137 155 };
138 let Some(handle) = self.place_call(CallSpec::Meeting(target.clone()), demo, cx) else {
156 let Some(handle) = self.place_call(CallSpec::Meeting(target.clone()), demo, false, cx)
157 else {
139 158 return;
140 159 };
141 160 let title = selection_for(&self.sidebar, conversation_id)
@@ -152,6 +171,7 @@ impl AppState {
152 171 &mut self,
153 172 spec: CallSpec,
154 173 demo: DemoCall,
174 with_video: bool,
155 175 cx: &mut Context<Self>,
156 176 ) -> Option<CallHandle> {
157 177 if self.mode.demo {
@@ -162,6 +182,7 @@ impl AppState {
162 182 return None;
163 183 }
164 184 match self.call_launcher.clone() {
185 Some(launcher) if with_video => Some(launcher.start_video_call(spec)),
165 186 Some(launcher) => Some(launcher.start_call(spec)),
166 187 None => {
167 188 self.raise_notice(NOT_CONNECTED_NOTICE.to_owned(), None, cx);
@@ -67,13 +67,26 @@ impl AppState {
67 self.show_call(true, cx);
67 self.show_call(true, cx);
68 return;
68 return;
69 }
69 }
70 let Some(handle) = self.place_call(CallSpec::Echo, DemoCall::Test, cx) else {
70 let Some(handle) = self.place_call(CallSpec::Echo, DemoCall::Test, false, cx) else {
71 return;
71 return;
72 };
72 };
73 self.begin_call(handle, CallModel::test(), None, cx);
73 self.begin_call(handle, CallModel::test(), None, cx);
74 }
74 }
75
75
76 pub fn start_chat_call(&mut self, conversation_id: &str, cx: &mut Context<Self>) {
76 pub fn start_chat_call(&mut self, conversation_id: &str, cx: &mut Context<Self>) {
77 self.start_chat_call_with(conversation_id, false, cx);
78 }
79
80 pub fn start_chat_video_call(&mut self, conversation_id: &str, cx: &mut Context<Self>) {
81 self.start_chat_call_with(conversation_id, true, cx);
82 }
83
84 fn start_chat_call_with(
85 &mut self,
86 conversation_id: &str,
87 with_video: bool,
88 cx: &mut Context<Self>,
89 ) {
77 if self.call.is_some() {
90 if self.call.is_some() {
78 self.show_call(true, cx);
91 self.show_call(true, cx);
79 return;
92 return;
@@ -99,7 +112,9 @@ impl AppState {
99 .collect(),
112 .collect(),
100 thread_id: conversation_id.to_owned(),
113 thread_id: conversation_id.to_owned(),
101 };
114 };
102 let Some(handle) = self.place_call(spec, DemoCall::People(plan.callees.clone()), cx) else {
115 let Some(handle) =
116 self.place_call(spec, DemoCall::People(plan.callees.clone()), with_video, cx)
117 else {
103 return;
118 return;
104 };
119 };
105 let user_ids = plan
120 let user_ids = plan
@@ -110,6 +125,9 @@ impl AppState {
110 self.request_avatars(user_ids, cx);
125 self.request_avatars(user_ids, cx);
111 let model = CallModel::people(&plan.title, &plan.callees);
126 let model = CallModel::people(&plan.title, &plan.callees);
112 self.begin_call(handle, model, Some(conversation_id.to_owned()), cx);
127 self.begin_call(handle, model, Some(conversation_id.to_owned()), cx);
128 if with_video && self.mode.demo {
129 self.send_call_command(CallCommand::SetCamera(true));
130 }
113 }
131 }
114
132
115 pub fn join_meeting_call(&mut self, conversation_id: &str, cx: &mut Context<Self>) {
133 pub fn join_meeting_call(&mut self, conversation_id: &str, cx: &mut Context<Self>) {
@@ -135,7 +153,8 @@ impl AppState {
135 lobby: conversation_id == DEMO_LOBBY_MEETING,
153 lobby: conversation_id == DEMO_LOBBY_MEETING,
136 organizer: conversation_id != DEMO_LOBBY_MEETING,
154 organizer: conversation_id != DEMO_LOBBY_MEETING,
137 };
155 };
138 let Some(handle) = self.place_call(CallSpec::Meeting(target.clone()), demo, cx) else {
156 let Some(handle) = self.place_call(CallSpec::Meeting(target.clone()), demo, false, cx)
157 else {
139 return;
158 return;
140 };
159 };
141 let title = selection_for(&self.sidebar, conversation_id)
160 let title = selection_for(&self.sidebar, conversation_id)
@@ -152,6 +171,7 @@ impl AppState {
152 &mut self,
171 &mut self,
153 spec: CallSpec,
172 spec: CallSpec,
154 demo: DemoCall,
173 demo: DemoCall,
174 with_video: bool,
155 cx: &mut Context<Self>,
175 cx: &mut Context<Self>,
156 ) -> Option<CallHandle> {
176 ) -> Option<CallHandle> {
157 if self.mode.demo {
177 if self.mode.demo {
@@ -162,6 +182,7 @@ impl AppState {
162 return None;
182 return None;
163 }
183 }
164 match self.call_launcher.clone() {
184 match self.call_launcher.clone() {
185 Some(launcher) if with_video => Some(launcher.start_video_call(spec)),
165 Some(launcher) => Some(launcher.start_call(spec)),
186 Some(launcher) => Some(launcher.start_call(spec)),
166 None => {
187 None => {
167 self.raise_notice(NOT_CONNECTED_NOTICE.to_owned(), None, cx);
188 self.raise_notice(NOT_CONNECTED_NOTICE.to_owned(), None, cx);
crates/app/src/call/features.rs +2 −1
@@ -352,7 +352,8 @@ impl AppState {
352 352 lobby: false,
353 353 organizer: false,
354 354 };
355 let Some(handle) = self.place_call(CallSpec::Meeting(moved.target.clone()), demo, cx)
355 let Some(handle) =
356 self.place_call(CallSpec::Meeting(moved.target.clone()), demo, false, cx)
356 357 else {
357 358 return;
358 359 };
@@ -352,7 +352,8 @@ impl AppState {
352 lobby: false,
352 lobby: false,
353 organizer: false,
353 organizer: false,
354 };
354 };
355 let Some(handle) = self.place_call(CallSpec::Meeting(moved.target.clone()), demo, cx)
355 let Some(handle) =
356 self.place_call(CallSpec::Meeting(moved.target.clone()), demo, false, cx)
356 else {
357 else {
357 return;
358 return;
358 };
359 };
crates/app/src/call/join.rs +1 −1
@@ -50,7 +50,7 @@ impl AppState {
50 50 lobby: false,
51 51 organizer: false,
52 52 };
53 let Some(handle) = self.place_call(CallSpec::Meeting(target), demo, cx) else {
53 let Some(handle) = self.place_call(CallSpec::Meeting(target), demo, false, cx) else {
54 54 return;
55 55 };
56 56 self.begin_call(
@@ -50,7 +50,7 @@ impl AppState {
50 lobby: false,
50 lobby: false,
51 organizer: false,
51 organizer: false,
52 };
52 };
53 let Some(handle) = self.place_call(CallSpec::Meeting(target), demo, cx) else {
53 let Some(handle) = self.place_call(CallSpec::Meeting(target), demo, false, cx) else {
54 return;
54 return;
55 };
55 };
56 self.begin_call(
56 self.begin_call(
crates/app/src/call/launcher.rs +7 −0
@@ -70,6 +70,13 @@ impl CallLauncher {
70 70 }
71 71 }
72 72
73 pub fn start_video_call(&self, spec: CallSpec) -> CallHandle {
74 match self.engine() {
75 Some(engine) => engine.start_video_call(spec),
76 None => failed_handle(NOT_READY),
77 }
78 }
79
73 80 pub fn start_consult(&self, spec: CallSpec) -> CallHandle {
74 81 match self.engine() {
75 82 Some(engine) => engine.start_consult(spec),
@@ -70,6 +70,13 @@ impl CallLauncher {
70 }
70 }
71 }
71 }
72
72
73 pub fn start_video_call(&self, spec: CallSpec) -> CallHandle {
74 match self.engine() {
75 Some(engine) => engine.start_video_call(spec),
76 None => failed_handle(NOT_READY),
77 }
78 }
79
73 pub fn start_consult(&self, spec: CallSpec) -> CallHandle {
80 pub fn start_consult(&self, spec: CallSpec) -> CallHandle {
74 match self.engine() {
81 match self.engine() {
75 Some(engine) => engine.start_consult(spec),
82 Some(engine) => engine.start_consult(spec),
crates/app/src/views/call_controls.rs +26 −17
@@ -55,23 +55,32 @@ pub fn header_call_controls(
55 55 .find(|chat| &chat.id == chat_id)
56 56 .is_some_and(|chat| plan_for_chat(chat, state.directory.me.as_ref()).is_some()));
57 57 if callable {
58 let call_app = app.clone();
59 controls.push(
60 Button::new("header-call")
61 .ghost()
62 .p_0()
63 .size(px(BUTTON_SIZE))
64 .tooltip("Call")
65 .child(icon(IconName::Phone, GLYPH_SIZE, theme::text_soft()))
66 .on_click(move |_, _, cx| {
67 call_app.update(cx, |state, cx| {
68 if let Some(Selection::Chat(chat_id)) = state.selection.clone() {
69 state.start_chat_call(&chat_id, cx);
70 }
71 });
72 })
73 .into_any_element(),
74 );
58 for (id, tooltip, glyph, with_video) in [
59 ("header-video-call", "Video call", IconName::Video, true),
60 ("header-call", "Call", IconName::Phone, false),
61 ] {
62 let call_app = app.clone();
63 controls.push(
64 Button::new(id)
65 .ghost()
66 .p_0()
67 .size(px(BUTTON_SIZE))
68 .tooltip(tooltip)
69 .child(icon(glyph, GLYPH_SIZE, theme::text_soft()))
70 .on_click(move |_, _, cx| {
71 call_app.update(cx, |state, cx| {
72 if let Some(Selection::Chat(chat_id)) = state.selection.clone() {
73 if with_video {
74 state.start_chat_video_call(&chat_id, cx);
75 } else {
76 state.start_chat_call(&chat_id, cx);
77 }
78 }
79 });
80 })
81 .into_any_element(),
82 );
83 }
75 84 }
76 85 controls
77 86 }
@@ -55,23 +55,32 @@ pub fn header_call_controls(
55 .find(|chat| &chat.id == chat_id)
55 .find(|chat| &chat.id == chat_id)
56 .is_some_and(|chat| plan_for_chat(chat, state.directory.me.as_ref()).is_some()));
56 .is_some_and(|chat| plan_for_chat(chat, state.directory.me.as_ref()).is_some()));
57 if callable {
57 if callable {
58 let call_app = app.clone();
58 for (id, tooltip, glyph, with_video) in [
59 controls.push(
59 ("header-video-call", "Video call", IconName::Video, true),
60 Button::new("header-call")
60 ("header-call", "Call", IconName::Phone, false),
61 .ghost()
61 ] {
62 .p_0()
62 let call_app = app.clone();
63 .size(px(BUTTON_SIZE))
63 controls.push(
64 .tooltip("Call")
64 Button::new(id)
65 .child(icon(IconName::Phone, GLYPH_SIZE, theme::text_soft()))
65 .ghost()
66 .on_click(move |_, _, cx| {
66 .p_0()
67 call_app.update(cx, |state, cx| {
67 .size(px(BUTTON_SIZE))
68 if let Some(Selection::Chat(chat_id)) = state.selection.clone() {
68 .tooltip(tooltip)
69 state.start_chat_call(&chat_id, cx);
69 .child(icon(glyph, GLYPH_SIZE, theme::text_soft()))
70 }
70 .on_click(move |_, _, cx| {
71 });
71 call_app.update(cx, |state, cx| {
72 })
72 if let Some(Selection::Chat(chat_id)) = state.selection.clone() {
73 .into_any_element(),
73 if with_video {
74 );
74 state.start_chat_video_call(&chat_id, cx);
75 } else {
76 state.start_chat_call(&chat_id, cx);
77 }
78 }
79 });
80 })
81 .into_any_element(),
82 );
83 }
75 }
84 }
76 controls
85 controls
77}
86}
crates/app/src/views/call_organizer.rs +20 −16
@@ -453,6 +453,25 @@ fn meeting_items(mut popup: PopupMenu, app: &Entity<AppState>, model: &CallModel
453 453 )
454 454 }
455 455
456 pub fn chevron_button(button_id: &'static str, face_id: &'static str) -> Button {
457 Button::new(button_id)
458 .ghost()
459 .p_0()
460 .w(px(CAMERA_MENU_WIDTH))
461 .h(px(super::call_view::CONTROL_SIZE))
462 .rounded_full()
463 .child(
464 div()
465 .id(face_id)
466 .w(px(CAMERA_MENU_WIDTH))
467 .h(px(super::call_view::CONTROL_SIZE))
468 .flex()
469 .items_center()
470 .justify_center()
471 .child(icon(IconName::ChevronUp, 16., theme::text())),
472 )
473 }
474
456 475 pub fn camera_menu_button(
457 476 app: &Entity<AppState>,
458 477 model: &CallModel,
@@ -464,22 +483,7 @@ pub fn camera_menu_button(
464 483 let app = app.clone();
465 484 let model = model.clone();
466 485 Some(
467 Button::new("call-camera-menu")
468 .ghost()
469 .p_0()
470 .w(px(CAMERA_MENU_WIDTH))
471 .h(px(super::call_view::CONTROL_SIZE))
472 .rounded_full()
473 .child(
474 div()
475 .id("call-camera-menu-face")
476 .w(px(CAMERA_MENU_WIDTH))
477 .h(px(super::call_view::CONTROL_SIZE))
478 .flex()
479 .items_center()
480 .justify_center()
481 .child(icon(IconName::ChevronUp, 16., theme::text())),
482 )
486 chevron_button("call-camera-menu", "call-camera-menu-face")
483 487 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
484 488 camera_menu(popup, &app, &model, &backgrounds)
485 489 })
@@ -453,6 +453,25 @@ fn meeting_items(mut popup: PopupMenu, app: &Entity<AppState>, model: &CallModel
453 )
453 )
454}
454}
455
455
456pub fn chevron_button(button_id: &'static str, face_id: &'static str) -> Button {
457 Button::new(button_id)
458 .ghost()
459 .p_0()
460 .w(px(CAMERA_MENU_WIDTH))
461 .h(px(super::call_view::CONTROL_SIZE))
462 .rounded_full()
463 .child(
464 div()
465 .id(face_id)
466 .w(px(CAMERA_MENU_WIDTH))
467 .h(px(super::call_view::CONTROL_SIZE))
468 .flex()
469 .items_center()
470 .justify_center()
471 .child(icon(IconName::ChevronUp, 16., theme::text())),
472 )
473}
474
456pub fn camera_menu_button(
475pub fn camera_menu_button(
457 app: &Entity<AppState>,
476 app: &Entity<AppState>,
458 model: &CallModel,
477 model: &CallModel,
@@ -464,22 +483,7 @@ pub fn camera_menu_button(
464 let app = app.clone();
483 let app = app.clone();
465 let model = model.clone();
484 let model = model.clone();
466 Some(
485 Some(
467 Button::new("call-camera-menu")
486 chevron_button("call-camera-menu", "call-camera-menu-face")
468 .ghost()
469 .p_0()
470 .w(px(CAMERA_MENU_WIDTH))
471 .h(px(super::call_view::CONTROL_SIZE))
472 .rounded_full()
473 .child(
474 div()
475 .id("call-camera-menu-face")
476 .w(px(CAMERA_MENU_WIDTH))
477 .h(px(super::call_view::CONTROL_SIZE))
478 .flex()
479 .items_center()
480 .justify_center()
481 .child(icon(IconName::ChevronUp, 16., theme::text())),
482 )
483 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
487 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
484 camera_menu(popup, &app, &model, &backgrounds)
488 camera_menu(popup, &app, &model, &backgrounds)
485 })
489 })
crates/app/src/views/call_view.rs +13 −16
@@ -21,8 +21,8 @@ use super::call_extras::{
21 21 room_chip, whiteboard_stage,
22 22 };
23 23 use super::call_organizer::{
24 camera_menu_button, captions_hint_chip, captions_overlay, lobby_banner, more_button, pin_chip,
25 render_focus_stage, spotlight_chip, with_tile_menu,
24 camera_menu_button, captions_hint_chip, captions_overlay, chevron_button, lobby_banner,
25 more_button, pin_chip, render_focus_stage, spotlight_chip, with_tile_menu,
26 26 };
27 27 use super::call_stage::render_stage;
28 28 use super::conversation::ConversationView;
@@ -807,20 +807,10 @@ fn devices_menu(popup: PopupMenu, app: &Entity<AppState>, model: &CallModel) ->
807 807 popup
808 808 }
809 809
810 fn devices_button(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
810 fn mic_menu_button(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
811 811 let app = app.clone();
812 812 let model = model.clone();
813 Button::new("call-devices")
814 .ghost()
815 .p_0()
816 .size(px(CONTROL_SIZE))
817 .rounded_full()
818 .child(round_control(
819 "call-devices-face",
820 IconName::Volume2,
821 theme::surface_raised(),
822 theme::text(),
823 ))
813 chevron_button("call-mic-menu", "call-mic-menu-face")
824 814 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
825 815 devices_menu(popup, &app, &model)
826 816 })
@@ -1086,7 +1076,15 @@ pub fn render_call_view(
1086 1076 .gap(px(12.))
1087 1077 .items_center()
1088 1078 .justify_center()
1089 .child(mute_button(app, model, "call-mute", CONTROL_SIZE))
1079 .child(
1080 h_flex()
1081 .h(px(CONTROL_SIZE))
1082 .items_center()
1083 .rounded_full()
1084 .bg(theme::surface_raised())
1085 .child(mute_button(app, model, "call-mute", CONTROL_SIZE))
1086 .child(mic_menu_button(app, model)),
1087 )
1090 1088 .child(
1091 1089 h_flex()
1092 1090 .h(px(CONTROL_SIZE))
@@ -1101,7 +1099,6 @@ pub fn render_call_view(
1101 1099 row.child(hand_button(app, model))
1102 1100 .child(reactions_button(app, model))
1103 1101 })
1104 .child(devices_button(app, model))
1105 1102 .children(more_button(app, model))
1106 1103 .when(call.chat_thread().is_some(), |row| {
1107 1104 row.child(chat_button(app, call.chat_open, state.call_chat_unread()))
@@ -21,8 +21,8 @@ use super::call_extras::{
21 room_chip, whiteboard_stage,
21 room_chip, whiteboard_stage,
22};
22};
23use super::call_organizer::{
23use super::call_organizer::{
24 camera_menu_button, captions_hint_chip, captions_overlay, lobby_banner, more_button, pin_chip,
24 camera_menu_button, captions_hint_chip, captions_overlay, chevron_button, lobby_banner,
25 render_focus_stage, spotlight_chip, with_tile_menu,
25 more_button, pin_chip, render_focus_stage, spotlight_chip, with_tile_menu,
26};
26};
27use super::call_stage::render_stage;
27use super::call_stage::render_stage;
28use super::conversation::ConversationView;
28use super::conversation::ConversationView;
@@ -807,20 +807,10 @@ fn devices_menu(popup: PopupMenu, app: &Entity<AppState>, model: &CallModel) ->
807 popup
807 popup
808}
808}
809
809
810fn devices_button(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
810fn mic_menu_button(app: &Entity<AppState>, model: &CallModel) -> impl IntoElement {
811 let app = app.clone();
811 let app = app.clone();
812 let model = model.clone();
812 let model = model.clone();
813 Button::new("call-devices")
813 chevron_button("call-mic-menu", "call-mic-menu-face")
814 .ghost()
815 .p_0()
816 .size(px(CONTROL_SIZE))
817 .rounded_full()
818 .child(round_control(
819 "call-devices-face",
820 IconName::Volume2,
821 theme::surface_raised(),
822 theme::text(),
823 ))
824 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
814 .dropdown_menu_with_anchor(Anchor::BottomLeft, move |popup, _, _| {
825 devices_menu(popup, &app, &model)
815 devices_menu(popup, &app, &model)
826 })
816 })
@@ -1086,7 +1076,15 @@ pub fn render_call_view(
1086 .gap(px(12.))
1076 .gap(px(12.))
1087 .items_center()
1077 .items_center()
1088 .justify_center()
1078 .justify_center()
1089 .child(mute_button(app, model, "call-mute", CONTROL_SIZE))
1079 .child(
1080 h_flex()
1081 .h(px(CONTROL_SIZE))
1082 .items_center()
1083 .rounded_full()
1084 .bg(theme::surface_raised())
1085 .child(mute_button(app, model, "call-mute", CONTROL_SIZE))
1086 .child(mic_menu_button(app, model)),
1087 )
1090 .child(
1088 .child(
1091 h_flex()
1089 h_flex()
1092 .h(px(CONTROL_SIZE))
1090 .h(px(CONTROL_SIZE))
@@ -1101,7 +1099,6 @@ pub fn render_call_view(
1101 row.child(hand_button(app, model))
1099 row.child(hand_button(app, model))
1102 .child(reactions_button(app, model))
1100 .child(reactions_button(app, model))
1103 })
1101 })
1104 .child(devices_button(app, model))
1105 .children(more_button(app, model))
1102 .children(more_button(app, model))
1106 .when(call.chat_thread().is_some(), |row| {
1103 .when(call.chat_thread().is_some(), |row| {
1107 row.child(chat_button(app, call.chat_open, state.call_chat_unread()))
1104 row.child(chat_button(app, call.chat_open, state.call_chat_unread()))
crates/calling/src/call.rs +95 −19
@@ -21,9 +21,14 @@ use crate::audio::{SAMPLE_RATE, rms, tone_ratio, write_wav};
21 21 use crate::audio_io::{AudioMode, AudioSetup};
22 22 use crate::background::{BackgroundChoice, BackgroundPicture};
23 23 use crate::breakout::{self, RoomWatcher};
24 use crate::captions::{CAPTIONS_DATA_ID, CaptionEntry, CaptionFlow, CaptionState, CaptionStep, BotAction, parse_caption_message};
25 use crate::data_channel::Depacketizer;
24 use crate::callee_gate::{CalleeGate, roster_has_callee};
25 use crate::camera::{CameraDevice, list_cameras};
26 use crate::captions::{
27 BotAction, CAPTIONS_DATA_ID, CaptionEntry, CaptionFlow, CaptionState, CaptionStep,
28 parse_caption_message,
29 };
26 30 use crate::control::{CallCommand, CallControl, CallUpdate, Progress};
31 use crate::data_channel::Depacketizer;
27 32 use crate::devices::{self, DeviceChoice};
28 33 use crate::end::EndKind;
29 34 use crate::engine::{CallEngine, EngineConfig, Inner};
@@ -50,7 +55,6 @@ use crate::video_layout::{
50 55 CAMERA_MID, MediaDescription, ONE_TO_ONE_SHARE_MID, SlotTable, VideoLines, VideoRouter, add_one_to_one_lines, add_video_lines, offer_plan, one_to_one_plan,
51 56 };
52 57 use crate::video_send::{LocalVideo, VideoMode};
53 use crate::camera::{CameraDevice, list_cameras};
54 58 use crate::screen::{ShareKind, ShareSource, list_share_sources};
55 59 use crate::video_receive::{ReceiveChange, SourceRequester, VideoCounters, VideoReceive, spawn_video_pump};
56 60 use crate::trouter_events::{
@@ -97,6 +101,7 @@ pub struct CallOptions {
97 101 pub trace: bool,
98 102 pub data_channel: bool,
99 103 pub concurrent: bool,
104 pub start_camera: bool,
100 105 }
101 106
102 107 impl Default for CallOptions {
@@ -119,6 +124,7 @@ impl Default for CallOptions {
119 124 trace: std::env::var_os(crate::engine::TRACE_ENV).is_some(),
120 125 data_channel: data_channel_from_env(),
121 126 concurrent: false,
127 start_camera: false,
122 128 }
123 129 }
124 130 }
@@ -544,6 +550,10 @@ async fn next_peer_event(next: &mut Option<NextPeer>) -> Option<PeerEvent> {
544 550 }
545 551 }
546 552
553 fn video_possible(remote_set: bool, layout: Layout, path: MediaPath) -> bool {
554 remote_set && !(layout == Layout::OneToOne && path == MediaPath::Mixer)
555 }
556
547 557 #[allow(clippy::too_many_arguments)]
548 558 async fn drive(
549 559 inner: &Inner,
@@ -633,6 +643,7 @@ async fn drive(
633 643 let mut outgoing_deadline: Option<Instant> = None;
634 644 let is_meeting = spec.as_ref().is_some_and(CallSpec::is_meeting);
635 645 let is_echo = matches!(spec, Some(CallSpec::Echo));
646 let mut callee_gate = CalleeGate::new(spec.as_ref().is_some_and(CallSpec::is_people));
636 647 let meeting_target = match &spec {
637 648 Some(CallSpec::Meeting(target)) => Some(target.clone()),
638 649 _ => None,
@@ -818,15 +829,24 @@ async fn drive(
818 829 if let Some(thread) = &meeting_chat {
819 830 control.send(CallUpdate::MeetingChat(thread.clone()));
820 831 }
832 let mut start_camera_pending = options.start_camera;
821 833 loop {
834 if start_camera_pending && video_possible(remote_set, layout, negotiator.path()) {
835 start_camera_pending = false;
836 control.defer(CallCommand::SetCamera(true));
837 }
822 838 tokio::select! {
823 839 Some(callback) = callbacks.recv() => {
824 840 let request_id = callback.request_id;
825 841 match handle_callback(&callback, timeline) {
826 842 Ok(CallEvent::Acceptance(acceptance)) => {
827 843 replier.reply(request_id, 200, acceptance_acknowledgement(&links).to_string());
828 match negotiator.on_acceptance(acceptance.from_mixer) {
829 MediaAction::ApplyAnswer => {
844 if !acceptance.from_mixer && callee_gate.callee_joined() {
845 advance(state, CallSignal::MediaConnected, control);
846 }
847 let action = negotiator.on_acceptance(acceptance.from_mixer, layout == Layout::OneToOne);
848 match action {
849 MediaAction::ApplyAnswer | MediaAction::ApplyAnswerThenEscalate => {
830 850 let Some(media) = offered.as_ref() else { continue };
831 851 dump_sdp(options, "3-teams-answer.sdp", &acceptance.sdp);
832 852 if let Ok(answer) = to_browser_answer(&acceptance.sdp, &media.signaled, &media.browser_offer) {
@@ -843,7 +863,9 @@ async fn drive(
843 863 if let Some(link) = acceptance.links.get("replacement") {
844 864 control.send(CallUpdate::ReplacementLink(link.clone()));
845 865 }
846 outgoing_deadline = None;
866 if !callee_gate.is_waiting() {
867 outgoing_deadline = None;
868 }
847 869 let directions: Vec<String> = current
848 870 .peer
849 871 .transceivers()
@@ -858,6 +880,10 @@ async fn drive(
858 880 keep_alive_link = acceptance.links.get("callLeg").cloned();
859 881 keep_alive_seconds = acceptance.keep_alive_seconds;
860 882 keep_alive_at = Some(Instant::now() + keep_alive_period(keep_alive_seconds));
883 if action == MediaAction::ApplyAnswerThenEscalate {
884 let pending = escalate(&factory, &grant, options, &track, &remote, &links, &media_leg_id, &acceptance.links, &mut negotiator, live, timeline).await;
885 next = pending.or(next);
886 }
861 887 let remote = remote.clone();
862 888 let links = links.clone();
863 889 let thread_id = echo_thread.clone();
@@ -869,17 +895,8 @@ async fn drive(
869 895 });
870 896 }
871 897 MediaAction::Escalate => {
872 match start_escalation(&factory, &grant, options, &track, &remote, &links, &media_leg_id, &acceptance.links).await {
873 Ok(pending) => {
874 timeline.record("escalation", "new peer connection, new offer sent");
875 live.peers.push(pending.session.peer.clone());
876 next = Some(pending);
877 }
878 Err(error) => {
879 negotiator.escalation_failed();
880 timeline.record("escalation failed", error.to_string());
881 }
882 }
898 let pending = escalate(&factory, &grant, options, &track, &remote, &links, &media_leg_id, &acceptance.links, &mut negotiator, live, timeline).await;
899 next = pending.or(next);
883 900 }
884 901 _ => {}
885 902 }
@@ -976,6 +993,12 @@ async fn drive(
976 993 let entries = roster.entries();
977 994 timeline.record("roster", format!("{} participant(s)", entries.len()));
978 995 control.send(CallUpdate::Roster(entries));
996 if callee_gate.is_waiting() && roster_has_callee(roster.members().iter().map(|member| member.mri.as_str()), &own_mri) {
997 outgoing_deadline = None;
998 if callee_gate.callee_joined() {
999 advance(state, CallSignal::MediaConnected, control);
1000 }
1001 }
979 1002 let own_streams = roster.stream_summaries(&own_mri);
980 1003 if own_streams != report.own_streams {
981 1004 timeline.record("own media streams", own_streams.join("; "));
@@ -1131,7 +1154,9 @@ async fn drive(
1131 1154 match connection {
1132 1155 PeerConnectionState::Connected => {
1133 1156 reconnect_deadline = None;
1134 advance(state, CallSignal::MediaConnected, control);
1157 if callee_gate.media_connected() {
1158 advance(state, CallSignal::MediaConnected, control);
1159 }
1135 1160 if report.peer_connected_ms.is_none() {
1136 1161 report.peer_connected_ms = Some(timeline.elapsed_ms());
1137 1162 if let Some(hold) = options.hold_after_connected {
@@ -1242,7 +1267,7 @@ async fn drive(
1242 1267 }
1243 1268 Some(CallCommand::SetCamera(on)) => {
1244 1269 let direct = layout == Layout::OneToOne && negotiator.path() != MediaPath::Mixer;
1245 if !remote_set {
1270 if !remote_set || (on && !video_possible(remote_set, layout, negotiator.path())) {
1246 1271 control.send(CallUpdate::Notice(NOT_CONNECTED_FOR_VIDEO.into()));
1247 1272 } else if on && consent_pending {
1248 1273 control.send(CallUpdate::Notice(CONSENT_FIRST_NOTICE.into()));
@@ -1651,6 +1676,45 @@ async fn start_escalation(
1651 1676 })
1652 1677 }
1653 1678
1679 #[allow(clippy::too_many_arguments)]
1680 async fn escalate(
1681 factory: &PeerConnectionFactory,
1682 grant: &RelayGrant,
1683 options: &CallOptions,
1684 track: &RtcAudioTrack,
1685 remote: &RemoteCall,
1686 links: &CallbackLinks,
1687 media_leg_id: &str,
1688 acceptance_links: &BTreeMap<String, String>,
1689 negotiator: &mut MediaNegotiator,
1690 live: &mut Live,
1691 timeline: &Timeline,
1692 ) -> Option<NextPeer> {
1693 match start_escalation(
1694 factory,
1695 grant,
1696 options,
1697 track,
1698 remote,
1699 links,
1700 media_leg_id,
1701 acceptance_links,
1702 )
1703 .await
1704 {
1705 Ok(pending) => {
1706 timeline.record("escalation", "new peer connection, new offer sent");
1707 live.peers.push(pending.session.peer.clone());
1708 Some(pending)
1709 }
1710 Err(error) => {
1711 negotiator.escalation_failed();
1712 timeline.record("escalation failed", error.to_string());
1713 None
1714 }
1715 }
1716 }
1717
1654 1718 async fn answer_on_new_peer(
1655 1719 factory: &PeerConnectionFactory,
1656 1720 grant: &RelayGrant,
@@ -2349,6 +2413,18 @@ async fn collect_stats(peer: &PeerConnection) -> StatsSnapshot {
2349 2413 mod tests {
2350 2414 use super::*;
2351 2415
2416 #[test]
2417 fn video_is_possible_once_connected_and_not_waiting_on_a_mixer_escalation() {
2418 assert!(video_possible(true, Layout::OneToOne, MediaPath::Direct));
2419 assert!(video_possible(true, Layout::Conference, MediaPath::Mixer));
2420 assert!(!video_possible(true, Layout::OneToOne, MediaPath::Mixer));
2421 assert!(!video_possible(
2422 false,
2423 Layout::Conference,
2424 MediaPath::Direct
2425 ));
2426 }
2427
2352 2428 #[test]
2353 2429 fn keep_alive_fires_at_ninety_percent_of_the_interval() {
2354 2430 assert_eq!(keep_alive_period(Some(2700)), Duration::from_secs(2430));
@@ -21,9 +21,14 @@ use crate::audio::{SAMPLE_RATE, rms, tone_ratio, write_wav};
21use crate::audio_io::{AudioMode, AudioSetup};
21use crate::audio_io::{AudioMode, AudioSetup};
22use crate::background::{BackgroundChoice, BackgroundPicture};
22use crate::background::{BackgroundChoice, BackgroundPicture};
23use crate::breakout::{self, RoomWatcher};
23use crate::breakout::{self, RoomWatcher};
24use crate::captions::{CAPTIONS_DATA_ID, CaptionEntry, CaptionFlow, CaptionState, CaptionStep, BotAction, parse_caption_message};
24use crate::callee_gate::{CalleeGate, roster_has_callee};
25use crate::data_channel::Depacketizer;
25use crate::camera::{CameraDevice, list_cameras};
26use crate::captions::{
27 BotAction, CAPTIONS_DATA_ID, CaptionEntry, CaptionFlow, CaptionState, CaptionStep,
28 parse_caption_message,
29};
26use crate::control::{CallCommand, CallControl, CallUpdate, Progress};
30use crate::control::{CallCommand, CallControl, CallUpdate, Progress};
31use crate::data_channel::Depacketizer;
27use crate::devices::{self, DeviceChoice};
32use crate::devices::{self, DeviceChoice};
28use crate::end::EndKind;
33use crate::end::EndKind;
29use crate::engine::{CallEngine, EngineConfig, Inner};
34use crate::engine::{CallEngine, EngineConfig, Inner};
@@ -50,7 +55,6 @@ use crate::video_layout::{
50 CAMERA_MID, MediaDescription, ONE_TO_ONE_SHARE_MID, SlotTable, VideoLines, VideoRouter, add_one_to_one_lines, add_video_lines, offer_plan, one_to_one_plan,
55 CAMERA_MID, MediaDescription, ONE_TO_ONE_SHARE_MID, SlotTable, VideoLines, VideoRouter, add_one_to_one_lines, add_video_lines, offer_plan, one_to_one_plan,
51};
56};
52use crate::video_send::{LocalVideo, VideoMode};
57use crate::video_send::{LocalVideo, VideoMode};
53use crate::camera::{CameraDevice, list_cameras};
54use crate::screen::{ShareKind, ShareSource, list_share_sources};
58use crate::screen::{ShareKind, ShareSource, list_share_sources};
55use crate::video_receive::{ReceiveChange, SourceRequester, VideoCounters, VideoReceive, spawn_video_pump};
59use crate::video_receive::{ReceiveChange, SourceRequester, VideoCounters, VideoReceive, spawn_video_pump};
56use crate::trouter_events::{
60use crate::trouter_events::{
@@ -97,6 +101,7 @@ pub struct CallOptions {
97 pub trace: bool,
101 pub trace: bool,
98 pub data_channel: bool,
102 pub data_channel: bool,
99 pub concurrent: bool,
103 pub concurrent: bool,
104 pub start_camera: bool,
100}
105}
101
106
102impl Default for CallOptions {
107impl Default for CallOptions {
@@ -119,6 +124,7 @@ impl Default for CallOptions {
119 trace: std::env::var_os(crate::engine::TRACE_ENV).is_some(),
124 trace: std::env::var_os(crate::engine::TRACE_ENV).is_some(),
120 data_channel: data_channel_from_env(),
125 data_channel: data_channel_from_env(),
121 concurrent: false,
126 concurrent: false,
127 start_camera: false,
122 }
128 }
123 }
129 }
124}
130}
@@ -544,6 +550,10 @@ async fn next_peer_event(next: &mut Option<NextPeer>) -> Option<PeerEvent> {
544 }
550 }
545}
551}
546
552
553fn video_possible(remote_set: bool, layout: Layout, path: MediaPath) -> bool {
554 remote_set && !(layout == Layout::OneToOne && path == MediaPath::Mixer)
555}
556
547#[allow(clippy::too_many_arguments)]
557#[allow(clippy::too_many_arguments)]
548async fn drive(
558async fn drive(
549 inner: &Inner,
559 inner: &Inner,
@@ -633,6 +643,7 @@ async fn drive(
633 let mut outgoing_deadline: Option<Instant> = None;
643 let mut outgoing_deadline: Option<Instant> = None;
634 let is_meeting = spec.as_ref().is_some_and(CallSpec::is_meeting);
644 let is_meeting = spec.as_ref().is_some_and(CallSpec::is_meeting);
635 let is_echo = matches!(spec, Some(CallSpec::Echo));
645 let is_echo = matches!(spec, Some(CallSpec::Echo));
646 let mut callee_gate = CalleeGate::new(spec.as_ref().is_some_and(CallSpec::is_people));
636 let meeting_target = match &spec {
647 let meeting_target = match &spec {
637 Some(CallSpec::Meeting(target)) => Some(target.clone()),
648 Some(CallSpec::Meeting(target)) => Some(target.clone()),
638 _ => None,
649 _ => None,
@@ -818,15 +829,24 @@ async fn drive(
818 if let Some(thread) = &meeting_chat {
829 if let Some(thread) = &meeting_chat {
819 control.send(CallUpdate::MeetingChat(thread.clone()));
830 control.send(CallUpdate::MeetingChat(thread.clone()));
820 }
831 }
832 let mut start_camera_pending = options.start_camera;
821 loop {
833 loop {
834 if start_camera_pending && video_possible(remote_set, layout, negotiator.path()) {
835 start_camera_pending = false;
836 control.defer(CallCommand::SetCamera(true));
837 }
822 tokio::select! {
838 tokio::select! {
823 Some(callback) = callbacks.recv() => {
839 Some(callback) = callbacks.recv() => {
824 let request_id = callback.request_id;
840 let request_id = callback.request_id;
825 match handle_callback(&callback, timeline) {
841 match handle_callback(&callback, timeline) {
826 Ok(CallEvent::Acceptance(acceptance)) => {
842 Ok(CallEvent::Acceptance(acceptance)) => {
827 replier.reply(request_id, 200, acceptance_acknowledgement(&links).to_string());
843 replier.reply(request_id, 200, acceptance_acknowledgement(&links).to_string());
828 match negotiator.on_acceptance(acceptance.from_mixer) {
844 if !acceptance.from_mixer && callee_gate.callee_joined() {
829 MediaAction::ApplyAnswer => {
845 advance(state, CallSignal::MediaConnected, control);
846 }
847 let action = negotiator.on_acceptance(acceptance.from_mixer, layout == Layout::OneToOne);
848 match action {
849 MediaAction::ApplyAnswer | MediaAction::ApplyAnswerThenEscalate => {
830 let Some(media) = offered.as_ref() else { continue };
850 let Some(media) = offered.as_ref() else { continue };
831 dump_sdp(options, "3-teams-answer.sdp", &acceptance.sdp);
851 dump_sdp(options, "3-teams-answer.sdp", &acceptance.sdp);
832 if let Ok(answer) = to_browser_answer(&acceptance.sdp, &media.signaled, &media.browser_offer) {
852 if let Ok(answer) = to_browser_answer(&acceptance.sdp, &media.signaled, &media.browser_offer) {
@@ -843,7 +863,9 @@ async fn drive(
843 if let Some(link) = acceptance.links.get("replacement") {
863 if let Some(link) = acceptance.links.get("replacement") {
844 control.send(CallUpdate::ReplacementLink(link.clone()));
864 control.send(CallUpdate::ReplacementLink(link.clone()));
845 }
865 }
846 outgoing_deadline = None;
866 if !callee_gate.is_waiting() {
867 outgoing_deadline = None;
868 }
847 let directions: Vec<String> = current
869 let directions: Vec<String> = current
848 .peer
870 .peer
849 .transceivers()
871 .transceivers()
@@ -858,6 +880,10 @@ async fn drive(
858 keep_alive_link = acceptance.links.get("callLeg").cloned();
880 keep_alive_link = acceptance.links.get("callLeg").cloned();
859 keep_alive_seconds = acceptance.keep_alive_seconds;
881 keep_alive_seconds = acceptance.keep_alive_seconds;
860 keep_alive_at = Some(Instant::now() + keep_alive_period(keep_alive_seconds));
882 keep_alive_at = Some(Instant::now() + keep_alive_period(keep_alive_seconds));
883 if action == MediaAction::ApplyAnswerThenEscalate {
884 let pending = escalate(&factory, &grant, options, &track, &remote, &links, &media_leg_id, &acceptance.links, &mut negotiator, live, timeline).await;
885 next = pending.or(next);
886 }
861 let remote = remote.clone();
887 let remote = remote.clone();
862 let links = links.clone();
888 let links = links.clone();
863 let thread_id = echo_thread.clone();
889 let thread_id = echo_thread.clone();
@@ -869,17 +895,8 @@ async fn drive(
869 });
895 });
870 }
896 }
871 MediaAction::Escalate => {
897 MediaAction::Escalate => {
872 match start_escalation(&factory, &grant, options, &track, &remote, &links, &media_leg_id, &acceptance.links).await {
898 let pending = escalate(&factory, &grant, options, &track, &remote, &links, &media_leg_id, &acceptance.links, &mut negotiator, live, timeline).await;
873 Ok(pending) => {
899 next = pending.or(next);
874 timeline.record("escalation", "new peer connection, new offer sent");
875 live.peers.push(pending.session.peer.clone());
876 next = Some(pending);
877 }
878 Err(error) => {
879 negotiator.escalation_failed();
880 timeline.record("escalation failed", error.to_string());
881 }
882 }
883 }
900 }
884 _ => {}
901 _ => {}
885 }
902 }
@@ -976,6 +993,12 @@ async fn drive(
976 let entries = roster.entries();
993 let entries = roster.entries();
977 timeline.record("roster", format!("{} participant(s)", entries.len()));
994 timeline.record("roster", format!("{} participant(s)", entries.len()));
978 control.send(CallUpdate::Roster(entries));
995 control.send(CallUpdate::Roster(entries));
996 if callee_gate.is_waiting() && roster_has_callee(roster.members().iter().map(|member| member.mri.as_str()), &own_mri) {
997 outgoing_deadline = None;
998 if callee_gate.callee_joined() {
999 advance(state, CallSignal::MediaConnected, control);
1000 }
1001 }
979 let own_streams = roster.stream_summaries(&own_mri);
1002 let own_streams = roster.stream_summaries(&own_mri);
980 if own_streams != report.own_streams {
1003 if own_streams != report.own_streams {
981 timeline.record("own media streams", own_streams.join("; "));
1004 timeline.record("own media streams", own_streams.join("; "));
@@ -1131,7 +1154,9 @@ async fn drive(
1131 match connection {
1154 match connection {
1132 PeerConnectionState::Connected => {
1155 PeerConnectionState::Connected => {
1133 reconnect_deadline = None;
1156 reconnect_deadline = None;
1134 advance(state, CallSignal::MediaConnected, control);
1157 if callee_gate.media_connected() {
1158 advance(state, CallSignal::MediaConnected, control);
1159 }
1135 if report.peer_connected_ms.is_none() {
1160 if report.peer_connected_ms.is_none() {
1136 report.peer_connected_ms = Some(timeline.elapsed_ms());
1161 report.peer_connected_ms = Some(timeline.elapsed_ms());
1137 if let Some(hold) = options.hold_after_connected {
1162 if let Some(hold) = options.hold_after_connected {
@@ -1242,7 +1267,7 @@ async fn drive(
1242 }
1267 }
1243 Some(CallCommand::SetCamera(on)) => {
1268 Some(CallCommand::SetCamera(on)) => {
1244 let direct = layout == Layout::OneToOne && negotiator.path() != MediaPath::Mixer;
1269 let direct = layout == Layout::OneToOne && negotiator.path() != MediaPath::Mixer;
1245 if !remote_set {
1270 if !remote_set || (on && !video_possible(remote_set, layout, negotiator.path())) {
1246 control.send(CallUpdate::Notice(NOT_CONNECTED_FOR_VIDEO.into()));
1271 control.send(CallUpdate::Notice(NOT_CONNECTED_FOR_VIDEO.into()));
1247 } else if on && consent_pending {
1272 } else if on && consent_pending {
1248 control.send(CallUpdate::Notice(CONSENT_FIRST_NOTICE.into()));
1273 control.send(CallUpdate::Notice(CONSENT_FIRST_NOTICE.into()));
@@ -1651,6 +1676,45 @@ async fn start_escalation(
1651 })
1676 })
1652}
1677}
1653
1678
1679#[allow(clippy::too_many_arguments)]
1680async fn escalate(
1681 factory: &PeerConnectionFactory,
1682 grant: &RelayGrant,
1683 options: &CallOptions,
1684 track: &RtcAudioTrack,
1685 remote: &RemoteCall,
1686 links: &CallbackLinks,
1687 media_leg_id: &str,
1688 acceptance_links: &BTreeMap<String, String>,
1689 negotiator: &mut MediaNegotiator,
1690 live: &mut Live,
1691 timeline: &Timeline,
1692) -> Option<NextPeer> {
1693 match start_escalation(
1694 factory,
1695 grant,
1696 options,
1697 track,
1698 remote,
1699 links,
1700 media_leg_id,
1701 acceptance_links,
1702 )
1703 .await
1704 {
1705 Ok(pending) => {
1706 timeline.record("escalation", "new peer connection, new offer sent");
1707 live.peers.push(pending.session.peer.clone());
1708 Some(pending)
1709 }
1710 Err(error) => {
1711 negotiator.escalation_failed();
1712 timeline.record("escalation failed", error.to_string());
1713 None
1714 }
1715 }
1716}
1717
1654async fn answer_on_new_peer(
1718async fn answer_on_new_peer(
1655 factory: &PeerConnectionFactory,
1719 factory: &PeerConnectionFactory,
1656 grant: &RelayGrant,
1720 grant: &RelayGrant,
@@ -2349,6 +2413,18 @@ async fn collect_stats(peer: &PeerConnection) -> StatsSnapshot {
2349mod tests {
2413mod tests {
2350 use super::*;
2414 use super::*;
2351
2415
2416 #[test]
2417 fn video_is_possible_once_connected_and_not_waiting_on_a_mixer_escalation() {
2418 assert!(video_possible(true, Layout::OneToOne, MediaPath::Direct));
2419 assert!(video_possible(true, Layout::Conference, MediaPath::Mixer));
2420 assert!(!video_possible(true, Layout::OneToOne, MediaPath::Mixer));
2421 assert!(!video_possible(
2422 false,
2423 Layout::Conference,
2424 MediaPath::Direct
2425 ));
2426 }
2427
2352 #[test]
2428 #[test]
2353 fn keep_alive_fires_at_ninety_percent_of_the_interval() {
2429 fn keep_alive_fires_at_ninety_percent_of_the_interval() {
2354 assert_eq!(keep_alive_period(Some(2700)), Duration::from_secs(2430));
2430 assert_eq!(keep_alive_period(Some(2700)), Duration::from_secs(2430));
crates/calling/src/callee_gate.rs added +82 −0
@@ -0,0 +1,82 @@
1 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
2 pub struct CalleeGate {
3 required: bool,
4 joined: bool,
5 media_connected: bool,
6 }
7
8 impl CalleeGate {
9 pub fn new(required: bool) -> Self {
10 CalleeGate {
11 required,
12 joined: false,
13 media_connected: false,
14 }
15 }
16
17 pub fn is_waiting(&self) -> bool {
18 self.required && !self.joined
19 }
20
21 pub fn media_connected(&mut self) -> bool {
22 self.media_connected = true;
23 !self.is_waiting()
24 }
25
26 pub fn callee_joined(&mut self) -> bool {
27 let was_waiting = self.is_waiting();
28 self.joined = true;
29 was_waiting && self.media_connected
30 }
31 }
32
33 pub fn roster_has_callee<'a>(
34 participant_mris: impl IntoIterator<Item = &'a str>,
35 own_mri: &str,
36 ) -> bool {
37 participant_mris.into_iter().any(|mri| mri != own_mri)
38 }
39
40 #[cfg(test)]
41 mod tests {
42 use super::*;
43
44 #[test]
45 fn a_roster_with_only_ourselves_has_no_callee() {
46 assert!(!roster_has_callee(["8:orgid:me"], "8:orgid:me"));
47 assert!(!roster_has_callee([], "8:orgid:me"));
48 }
49
50 #[test]
51 fn a_roster_with_someone_else_has_the_callee() {
52 assert!(roster_has_callee(
53 ["8:orgid:me", "8:orgid:them"],
54 "8:orgid:me"
55 ));
56 }
57
58 #[test]
59 fn media_waits_for_the_callee_when_required() {
60 let mut gate = CalleeGate::new(true);
61 assert!(!gate.media_connected());
62 assert!(gate.is_waiting());
63 assert!(gate.callee_joined());
64 assert!(!gate.is_waiting());
65 assert!(gate.media_connected());
66 }
67
68 #[test]
69 fn a_callee_before_media_does_not_fire_early() {
70 let mut gate = CalleeGate::new(true);
71 assert!(!gate.callee_joined());
72 assert!(gate.media_connected());
73 }
74
75 #[test]
76 fn an_unrequired_gate_never_waits() {
77 let mut gate = CalleeGate::new(false);
78 assert!(!gate.is_waiting());
79 assert!(gate.media_connected());
80 assert!(!gate.callee_joined());
81 }
82 }
@@ -0,0 +1,82 @@
1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub struct CalleeGate {
3 required: bool,
4 joined: bool,
5 media_connected: bool,
6}
7
8impl CalleeGate {
9 pub fn new(required: bool) -> Self {
10 CalleeGate {
11 required,
12 joined: false,
13 media_connected: false,
14 }
15 }
16
17 pub fn is_waiting(&self) -> bool {
18 self.required && !self.joined
19 }
20
21 pub fn media_connected(&mut self) -> bool {
22 self.media_connected = true;
23 !self.is_waiting()
24 }
25
26 pub fn callee_joined(&mut self) -> bool {
27 let was_waiting = self.is_waiting();
28 self.joined = true;
29 was_waiting && self.media_connected
30 }
31}
32
33pub fn roster_has_callee<'a>(
34 participant_mris: impl IntoIterator<Item = &'a str>,
35 own_mri: &str,
36) -> bool {
37 participant_mris.into_iter().any(|mri| mri != own_mri)
38}
39
40#[cfg(test)]
41mod tests {
42 use super::*;
43
44 #[test]
45 fn a_roster_with_only_ourselves_has_no_callee() {
46 assert!(!roster_has_callee(["8:orgid:me"], "8:orgid:me"));
47 assert!(!roster_has_callee([], "8:orgid:me"));
48 }
49
50 #[test]
51 fn a_roster_with_someone_else_has_the_callee() {
52 assert!(roster_has_callee(
53 ["8:orgid:me", "8:orgid:them"],
54 "8:orgid:me"
55 ));
56 }
57
58 #[test]
59 fn media_waits_for_the_callee_when_required() {
60 let mut gate = CalleeGate::new(true);
61 assert!(!gate.media_connected());
62 assert!(gate.is_waiting());
63 assert!(gate.callee_joined());
64 assert!(!gate.is_waiting());
65 assert!(gate.media_connected());
66 }
67
68 #[test]
69 fn a_callee_before_media_does_not_fire_early() {
70 let mut gate = CalleeGate::new(true);
71 assert!(!gate.callee_joined());
72 assert!(gate.media_connected());
73 }
74
75 #[test]
76 fn an_unrequired_gate_never_waits() {
77 let mut gate = CalleeGate::new(false);
78 assert!(!gate.is_waiting());
79 assert!(gate.media_connected());
80 assert!(!gate.callee_joined());
81 }
82}
crates/calling/src/control.rs +4 −0
@@ -140,6 +140,10 @@ impl CallControl {
140 140 self.updates.clone()
141 141 }
142 142
143 pub fn defer(&mut self, command: CallCommand) {
144 self.deferred.push(command);
145 }
146
143 147 pub fn try_recv_command(&mut self) -> Option<CallCommand> {
144 148 if !self.deferred.is_empty() {
145 149 return Some(self.deferred.remove(0));
@@ -140,6 +140,10 @@ impl CallControl {
140 self.updates.clone()
140 self.updates.clone()
141 }
141 }
142
142
143 pub fn defer(&mut self, command: CallCommand) {
144 self.deferred.push(command);
145 }
146
143 pub fn try_recv_command(&mut self) -> Option<CallCommand> {
147 pub fn try_recv_command(&mut self) -> Option<CallCommand> {
144 if !self.deferred.is_empty() {
148 if !self.deferred.is_empty() {
145 return Some(self.deferred.remove(0));
149 return Some(self.deferred.remove(0));
crates/calling/src/engine.rs +8 −4
@@ -274,18 +274,22 @@ impl CallEngine {
274 274 }
275 275
276 276 pub fn start_call(&self, spec: CallSpec) -> CallHandle {
277 self.start_call_with(spec, false)
277 self.start_call_with(spec, false, false)
278 }
279
280 pub fn start_video_call(&self, spec: CallSpec) -> CallHandle {
281 self.start_call_with(spec, false, true)
278 282 }
279 283
280 284 pub fn start_consult(&self, spec: CallSpec) -> CallHandle {
281 self.start_call_with(spec, true)
285 self.start_call_with(spec, true, false)
282 286 }
283 287
284 fn start_call_with(&self, spec: CallSpec, concurrent: bool) -> CallHandle {
288 fn start_call_with(&self, spec: CallSpec, concurrent: bool, start_camera: bool) -> CallHandle {
285 289 let (handle, control) = call_channel();
286 290 let engine = self.clone();
287 291 self.inner.runtime.spawn(async move {
288 let options = CallOptions { concurrent, ..engine.inner.call_options() };
292 let options = CallOptions { concurrent, start_camera, ..engine.inner.call_options() };
289 293 let _ = engine.run(Plan::Outgoing(spec), options, control).await;
290 294 });
291 295 handle
@@ -274,18 +274,22 @@ impl CallEngine {
274 }
274 }
275
275
276 pub fn start_call(&self, spec: CallSpec) -> CallHandle {
276 pub fn start_call(&self, spec: CallSpec) -> CallHandle {
277 self.start_call_with(spec, false)
277 self.start_call_with(spec, false, false)
278 }
279
280 pub fn start_video_call(&self, spec: CallSpec) -> CallHandle {
281 self.start_call_with(spec, false, true)
278 }
282 }
279
283
280 pub fn start_consult(&self, spec: CallSpec) -> CallHandle {
284 pub fn start_consult(&self, spec: CallSpec) -> CallHandle {
281 self.start_call_with(spec, true)
285 self.start_call_with(spec, true, false)
282 }
286 }
283
287
284 fn start_call_with(&self, spec: CallSpec, concurrent: bool) -> CallHandle {
288 fn start_call_with(&self, spec: CallSpec, concurrent: bool, start_camera: bool) -> CallHandle {
285 let (handle, control) = call_channel();
289 let (handle, control) = call_channel();
286 let engine = self.clone();
290 let engine = self.clone();
287 self.inner.runtime.spawn(async move {
291 self.inner.runtime.spawn(async move {
288 let options = CallOptions { concurrent, ..engine.inner.call_options() };
292 let options = CallOptions { concurrent, start_camera, ..engine.inner.call_options() };
289 let _ = engine.run(Plan::Outgoing(spec), options, control).await;
293 let _ = engine.run(Plan::Outgoing(spec), options, control).await;
290 });
294 });
291 handle
295 handle
crates/calling/src/lib.rs +1 −0
@@ -2,6 +2,7 @@ pub mod audio;
2 2 pub mod audio_io;
3 3 pub mod background;
4 4 pub mod call;
5 pub mod callee_gate;
5 6 pub mod blur;
6 7 pub mod breakout;
7 8 pub mod camera;
@@ -2,6 +2,7 @@ pub mod audio;
2pub mod audio_io;
2pub mod audio_io;
3pub mod background;
3pub mod background;
4pub mod call;
4pub mod call;
5pub mod callee_gate;
5pub mod blur;
6pub mod blur;
6pub mod breakout;
7pub mod breakout;
7pub mod camera;
8pub mod camera;
crates/calling/src/renegotiation.rs +40 −16
@@ -8,6 +8,7 @@ pub enum MediaPath {
8 8 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
9 9 pub enum MediaAction {
10 10 ApplyAnswer,
11 ApplyAnswerThenEscalate,
11 12 Escalate,
12 13 ApplyOnNewPeer,
13 14 ApplyOnSamePeer,
@@ -43,8 +44,13 @@ impl MediaNegotiator {
43 44 self.path = if from_mixer { MediaPath::Mixer } else { MediaPath::Direct };
44 45 }
45 46
46 pub fn on_acceptance(&mut self, from_mixer: bool) -> MediaAction {
47 pub fn on_acceptance(&mut self, from_mixer: bool, one_to_one_layout: bool) -> MediaAction {
47 48 match (self.path, from_mixer) {
49 (MediaPath::Pending, true) if one_to_one_layout => {
50 self.path = MediaPath::Mixer;
51 self.own_offer_pending = true;
52 MediaAction::ApplyAnswerThenEscalate
53 }
48 54 (MediaPath::Pending, _) => {
49 55 self.path = if from_mixer { MediaPath::Mixer } else { MediaPath::Direct };
50 56 MediaAction::ApplyAnswer
@@ -107,39 +113,54 @@ mod tests {
107 113 #[test]
108 114 fn the_first_answer_decides_the_path() {
109 115 let mut direct = MediaNegotiator::default();
110 assert_eq!(direct.on_acceptance(false), MediaAction::ApplyAnswer);
116 assert_eq!(direct.on_acceptance(false, false), MediaAction::ApplyAnswer);
111 117 assert_eq!(direct.path(), MediaPath::Direct);
112 118 let mut mixer = MediaNegotiator::default();
113 assert_eq!(mixer.on_acceptance(true), MediaAction::ApplyAnswer);
119 assert_eq!(mixer.on_acceptance(true, false), MediaAction::ApplyAnswer);
114 120 assert_eq!(mixer.path(), MediaPath::Mixer);
115 121 }
116 122
117 123 #[test]
118 124 fn a_mixer_answer_during_a_direct_call_escalates_once() {
119 125 let mut negotiator = MediaNegotiator::default();
120 negotiator.on_acceptance(false);
121 assert_eq!(negotiator.on_acceptance(true), MediaAction::Escalate);
122 assert_eq!(negotiator.on_acceptance(true), MediaAction::Ignore);
126 negotiator.on_acceptance(false, false);
127 assert_eq!(negotiator.on_acceptance(true, false), MediaAction::Escalate);
128 assert_eq!(negotiator.on_acceptance(true, false), MediaAction::Ignore);
123 129 assert_eq!(negotiator.on_media_answer(), MediaAction::ApplyOnNewPeer);
124 130 assert_eq!(negotiator.path(), MediaPath::Mixer);
125 assert_eq!(negotiator.on_acceptance(true), MediaAction::Ignore);
131 assert_eq!(negotiator.on_acceptance(true, false), MediaAction::Ignore);
132 }
133
134 #[test]
135 fn a_mixer_answer_to_a_one_to_one_offer_applies_then_escalates_once() {
136 let mut negotiator = MediaNegotiator::default();
137 assert_eq!(
138 negotiator.on_acceptance(true, true),
139 MediaAction::ApplyAnswerThenEscalate
140 );
141 assert_eq!(negotiator.path(), MediaPath::Mixer);
142 assert_eq!(negotiator.on_acceptance(true, true), MediaAction::Ignore);
143 assert!(!negotiator.begin_same_peer_offer());
144 assert_eq!(negotiator.on_media_answer(), MediaAction::ApplyOnNewPeer);
145 let mut direct = MediaNegotiator::default();
146 assert_eq!(direct.on_acceptance(false, true), MediaAction::ApplyAnswer);
126 147 }
127 148
128 149 #[test]
129 150 fn later_acceptances_on_a_settled_path_are_ignored() {
130 151 let mut mixer = MediaNegotiator::default();
131 mixer.on_acceptance(true);
132 assert_eq!(mixer.on_acceptance(true), MediaAction::Ignore);
152 mixer.on_acceptance(true, false);
153 assert_eq!(mixer.on_acceptance(true, false), MediaAction::Ignore);
133 154 let mut direct = MediaNegotiator::default();
134 direct.on_acceptance(false);
135 assert_eq!(direct.on_acceptance(false), MediaAction::Ignore);
155 direct.on_acceptance(false, false);
156 assert_eq!(direct.on_acceptance(false, false), MediaAction::Ignore);
136 157 }
137 158
138 159 #[test]
139 160 fn a_media_answer_without_our_offer_is_ignored() {
140 161 let mut negotiator = MediaNegotiator::default();
141 162 assert_eq!(negotiator.on_media_answer(), MediaAction::Ignore);
142 negotiator.on_acceptance(false);
163 negotiator.on_acceptance(false, false);
143 164 assert_eq!(negotiator.on_media_answer(), MediaAction::Ignore);
144 165 }
145 166
@@ -164,7 +185,7 @@ mod tests {
164 185 #[test]
165 186 fn an_offer_on_the_same_peer_waits_for_its_answer_and_blocks_other_offers() {
166 187 let mut negotiator = MediaNegotiator::default();
167 negotiator.on_acceptance(false);
188 negotiator.on_acceptance(false, false);
168 189 assert!(negotiator.begin_same_peer_offer());
169 190 assert!(!negotiator.begin_same_peer_offer());
170 191 assert_eq!(negotiator.on_renegotiation(false, false), MediaAction::RejectGlare);
@@ -178,9 +199,12 @@ mod tests {
178 199 #[test]
179 200 fn two_offers_at_once_are_glare() {
180 201 let mut negotiator = MediaNegotiator::default();
181 negotiator.on_acceptance(false);
182 negotiator.on_acceptance(true);
183 assert_eq!(negotiator.on_renegotiation(true, true), MediaAction::RejectGlare);
202 negotiator.on_acceptance(false, false);
203 negotiator.on_acceptance(true, false);
204 assert_eq!(
205 negotiator.on_renegotiation(true, true),
206 MediaAction::RejectGlare
207 );
184 208 negotiator.escalation_failed();
185 209 assert_eq!(negotiator.on_renegotiation(true, true), MediaAction::AnswerOnNewPeer);
186 210 }
@@ -8,6 +8,7 @@ pub enum MediaPath {
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum MediaAction {
9pub enum MediaAction {
10 ApplyAnswer,
10 ApplyAnswer,
11 ApplyAnswerThenEscalate,
11 Escalate,
12 Escalate,
12 ApplyOnNewPeer,
13 ApplyOnNewPeer,
13 ApplyOnSamePeer,
14 ApplyOnSamePeer,
@@ -43,8 +44,13 @@ impl MediaNegotiator {
43 self.path = if from_mixer { MediaPath::Mixer } else { MediaPath::Direct };
44 self.path = if from_mixer { MediaPath::Mixer } else { MediaPath::Direct };
44 }
45 }
45
46
46 pub fn on_acceptance(&mut self, from_mixer: bool) -> MediaAction {
47 pub fn on_acceptance(&mut self, from_mixer: bool, one_to_one_layout: bool) -> MediaAction {
47 match (self.path, from_mixer) {
48 match (self.path, from_mixer) {
49 (MediaPath::Pending, true) if one_to_one_layout => {
50 self.path = MediaPath::Mixer;
51 self.own_offer_pending = true;
52 MediaAction::ApplyAnswerThenEscalate
53 }
48 (MediaPath::Pending, _) => {
54 (MediaPath::Pending, _) => {
49 self.path = if from_mixer { MediaPath::Mixer } else { MediaPath::Direct };
55 self.path = if from_mixer { MediaPath::Mixer } else { MediaPath::Direct };
50 MediaAction::ApplyAnswer
56 MediaAction::ApplyAnswer
@@ -107,39 +113,54 @@ mod tests {
107 #[test]
113 #[test]
108 fn the_first_answer_decides_the_path() {
114 fn the_first_answer_decides_the_path() {
109 let mut direct = MediaNegotiator::default();
115 let mut direct = MediaNegotiator::default();
110 assert_eq!(direct.on_acceptance(false), MediaAction::ApplyAnswer);
116 assert_eq!(direct.on_acceptance(false, false), MediaAction::ApplyAnswer);
111 assert_eq!(direct.path(), MediaPath::Direct);
117 assert_eq!(direct.path(), MediaPath::Direct);
112 let mut mixer = MediaNegotiator::default();
118 let mut mixer = MediaNegotiator::default();
113 assert_eq!(mixer.on_acceptance(true), MediaAction::ApplyAnswer);
119 assert_eq!(mixer.on_acceptance(true, false), MediaAction::ApplyAnswer);
114 assert_eq!(mixer.path(), MediaPath::Mixer);
120 assert_eq!(mixer.path(), MediaPath::Mixer);
115 }
121 }
116
122
117 #[test]
123 #[test]
118 fn a_mixer_answer_during_a_direct_call_escalates_once() {
124 fn a_mixer_answer_during_a_direct_call_escalates_once() {
119 let mut negotiator = MediaNegotiator::default();
125 let mut negotiator = MediaNegotiator::default();
120 negotiator.on_acceptance(false);
126 negotiator.on_acceptance(false, false);
121 assert_eq!(negotiator.on_acceptance(true), MediaAction::Escalate);
127 assert_eq!(negotiator.on_acceptance(true, false), MediaAction::Escalate);
122 assert_eq!(negotiator.on_acceptance(true), MediaAction::Ignore);
128 assert_eq!(negotiator.on_acceptance(true, false), MediaAction::Ignore);
123 assert_eq!(negotiator.on_media_answer(), MediaAction::ApplyOnNewPeer);
129 assert_eq!(negotiator.on_media_answer(), MediaAction::ApplyOnNewPeer);
124 assert_eq!(negotiator.path(), MediaPath::Mixer);
130 assert_eq!(negotiator.path(), MediaPath::Mixer);
125 assert_eq!(negotiator.on_acceptance(true), MediaAction::Ignore);
131 assert_eq!(negotiator.on_acceptance(true, false), MediaAction::Ignore);
132 }
133
134 #[test]
135 fn a_mixer_answer_to_a_one_to_one_offer_applies_then_escalates_once() {
136 let mut negotiator = MediaNegotiator::default();
137 assert_eq!(
138 negotiator.on_acceptance(true, true),
139 MediaAction::ApplyAnswerThenEscalate
140 );
141 assert_eq!(negotiator.path(), MediaPath::Mixer);
142 assert_eq!(negotiator.on_acceptance(true, true), MediaAction::Ignore);
143 assert!(!negotiator.begin_same_peer_offer());
144 assert_eq!(negotiator.on_media_answer(), MediaAction::ApplyOnNewPeer);
145 let mut direct = MediaNegotiator::default();
146 assert_eq!(direct.on_acceptance(false, true), MediaAction::ApplyAnswer);
126 }
147 }
127
148
128 #[test]
149 #[test]
129 fn later_acceptances_on_a_settled_path_are_ignored() {
150 fn later_acceptances_on_a_settled_path_are_ignored() {
130 let mut mixer = MediaNegotiator::default();
151 let mut mixer = MediaNegotiator::default();
131 mixer.on_acceptance(true);
152 mixer.on_acceptance(true, false);
132 assert_eq!(mixer.on_acceptance(true), MediaAction::Ignore);
153 assert_eq!(mixer.on_acceptance(true, false), MediaAction::Ignore);
133 let mut direct = MediaNegotiator::default();
154 let mut direct = MediaNegotiator::default();
134 direct.on_acceptance(false);
155 direct.on_acceptance(false, false);
135 assert_eq!(direct.on_acceptance(false), MediaAction::Ignore);
156 assert_eq!(direct.on_acceptance(false, false), MediaAction::Ignore);
136 }
157 }
137
158
138 #[test]
159 #[test]
139 fn a_media_answer_without_our_offer_is_ignored() {
160 fn a_media_answer_without_our_offer_is_ignored() {
140 let mut negotiator = MediaNegotiator::default();
161 let mut negotiator = MediaNegotiator::default();
141 assert_eq!(negotiator.on_media_answer(), MediaAction::Ignore);
162 assert_eq!(negotiator.on_media_answer(), MediaAction::Ignore);
142 negotiator.on_acceptance(false);
163 negotiator.on_acceptance(false, false);
143 assert_eq!(negotiator.on_media_answer(), MediaAction::Ignore);
164 assert_eq!(negotiator.on_media_answer(), MediaAction::Ignore);
144 }
165 }
145
166
@@ -164,7 +185,7 @@ mod tests {
164 #[test]
185 #[test]
165 fn an_offer_on_the_same_peer_waits_for_its_answer_and_blocks_other_offers() {
186 fn an_offer_on_the_same_peer_waits_for_its_answer_and_blocks_other_offers() {
166 let mut negotiator = MediaNegotiator::default();
187 let mut negotiator = MediaNegotiator::default();
167 negotiator.on_acceptance(false);
188 negotiator.on_acceptance(false, false);
168 assert!(negotiator.begin_same_peer_offer());
189 assert!(negotiator.begin_same_peer_offer());
169 assert!(!negotiator.begin_same_peer_offer());
190 assert!(!negotiator.begin_same_peer_offer());
170 assert_eq!(negotiator.on_renegotiation(false, false), MediaAction::RejectGlare);
191 assert_eq!(negotiator.on_renegotiation(false, false), MediaAction::RejectGlare);
@@ -178,9 +199,12 @@ mod tests {
178 #[test]
199 #[test]
179 fn two_offers_at_once_are_glare() {
200 fn two_offers_at_once_are_glare() {
180 let mut negotiator = MediaNegotiator::default();
201 let mut negotiator = MediaNegotiator::default();
181 negotiator.on_acceptance(false);
202 negotiator.on_acceptance(false, false);
182 negotiator.on_acceptance(true);
203 negotiator.on_acceptance(true, false);
183 assert_eq!(negotiator.on_renegotiation(true, true), MediaAction::RejectGlare);
204 assert_eq!(
205 negotiator.on_renegotiation(true, true),
206 MediaAction::RejectGlare
207 );
184 negotiator.escalation_failed();
208 negotiator.escalation_failed();
185 assert_eq!(negotiator.on_renegotiation(true, true), MediaAction::AnswerOnNewPeer);
209 assert_eq!(negotiator.on_renegotiation(true, true), MediaAction::AnswerOnNewPeer);
186 }
210 }