BlueGit

ict rusty-teams

fix(calling): golden answer test expects the local Opus send quality

- 150972e adds maxaveragebitrate=40000;maxplaybackrate=48000 to the Opus fmtp of the browser answer
- That answer only goes into the local libwebrtc (set_remote_description), Teams never sees it
- Captured fixture stays untouched; the test applies the one intended difference and fails if the captured line is missing

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

metis Daniel Däschle · pushed by metis

Authored 2026-10-17 · 6 weeks ago

Hash
5d38c5dbea48a52c7756839f1875931ce4c0af6a
Parent
c737a138
1 file changed +8 −1
crates/calling/tests/sdp_golden.rs +8 −1
@@ -103,12 +103,19 @@ fn differs_per_run(index: usize, line: &str) -> bool {
103 103 || (index > 1 && line.starts_with("a=fmtp:") && !line.contains("apt="))
104 104 }
105 105
106 /// The answer only goes into the local libwebrtc, never to Teams; it sizes our Opus encoder (fullband, 40 kbps).
107 fn with_local_opus_send_quality(mut expected: Vec<Vec<String>>) -> Vec<Vec<String>> {
108 let opus = expected[1].iter_mut().find(|line| *line == "a=fmtp:111 usedtx=1").expect("captured Opus fmtp");
109 *opus = "a=fmtp:111 usedtx=1;maxaveragebitrate=40000;maxplaybackrate=48000".into();
110 expected
111 }
112
106 113 #[test]
107 114 fn captured_teams_answer_translates_to_the_captured_browser_answer() {
108 115 let offer = to_teams_offer(BROWSER_OFFER, &captured_plan(), &mut counter()).unwrap();
109 116 let answer = to_browser_answer(TEAMS_ANSWER, &offer, BROWSER_OFFER).unwrap();
110 117 let actual = sections(&sdp::parse(&answer).unwrap());
111 let expected = sections(&sdp::parse(BROWSER_ANSWER).unwrap());
118 let expected = with_local_opus_send_quality(sections(&sdp::parse(BROWSER_ANSWER).unwrap()));
112 119 assert_same(actual, expected, differs_per_run);
113 120 }
114 121
@@ -103,12 +103,19 @@ fn differs_per_run(index: usize, line: &str) -> bool {
103 || (index > 1 && line.starts_with("a=fmtp:") && !line.contains("apt="))
103 || (index > 1 && line.starts_with("a=fmtp:") && !line.contains("apt="))
104}
104}
105
105
106/// The answer only goes into the local libwebrtc, never to Teams; it sizes our Opus encoder (fullband, 40 kbps).
107fn with_local_opus_send_quality(mut expected: Vec<Vec<String>>) -> Vec<Vec<String>> {
108 let opus = expected[1].iter_mut().find(|line| *line == "a=fmtp:111 usedtx=1").expect("captured Opus fmtp");
109 *opus = "a=fmtp:111 usedtx=1;maxaveragebitrate=40000;maxplaybackrate=48000".into();
110 expected
111}
112
106#[test]
113#[test]
107fn captured_teams_answer_translates_to_the_captured_browser_answer() {
114fn captured_teams_answer_translates_to_the_captured_browser_answer() {
108 let offer = to_teams_offer(BROWSER_OFFER, &captured_plan(), &mut counter()).unwrap();
115 let offer = to_teams_offer(BROWSER_OFFER, &captured_plan(), &mut counter()).unwrap();
109 let answer = to_browser_answer(TEAMS_ANSWER, &offer, BROWSER_OFFER).unwrap();
116 let answer = to_browser_answer(TEAMS_ANSWER, &offer, BROWSER_OFFER).unwrap();
110 let actual = sections(&sdp::parse(&answer).unwrap());
117 let actual = sections(&sdp::parse(&answer).unwrap());
111 let expected = sections(&sdp::parse(BROWSER_ANSWER).unwrap());
118 let expected = with_local_opus_send_quality(sections(&sdp::parse(BROWSER_ANSWER).unwrap()));
112 assert_same(actual, expected, differs_per_run);
119 assert_same(actual, expected, differs_per_run);
113}
120}
114
121