Skip to content

Commit eb32484

Browse files
committed
media: do not add renomination in Firefox
1 parent 544d60c commit eb32484

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

packages/media/src/webrtc/Session.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,10 @@ export default class Session {
210210
return this.pc.createAnswer();
211211
})
212212
.then((answer: any) => {
213+
answerToSignal = { ...answer };
214+
// Do not include the renegotiation flag in the signaling
215+
// message as it may not be supported by the other side.
213216
if (this._iceRenominationOn) answer.sdp = sdpModifier.enableIceRenomination(answer.sdp);
214-
answerToSignal = answer;
215217
return this.pc.setLocalDescription(answer);
216218
})
217219
.then(() => {

packages/media/src/webrtc/sdpModifier.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ export function deprioritizeH264(sdp: any) {
154154
// replace `a=ice-options:trickle` with `a=ice-options:trickle renomination`
155155
// https://datatracker.ietf.org/doc/html/draft-thatcher-ice-renomination-00
156156
export function enableIceRenomination(sdp: any) {
157+
if (browserName === "firefox") {
158+
return sdp;
159+
}
160+
157161
return (
158162
SDPUtils.splitLines(sdp.trim())
159163
.map((line) => (line === "a=ice-options:trickle" ? "a=ice-options:trickle renomination" : line))

packages/media/tests/webrtc/sdpModifier.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,23 @@ describe("sdpModifier", () => {
6868
});
6969

7070
describe("enableIceRenomination", () => {
71+
afterEach(() => {
72+
jest.resetModules();
73+
});
74+
75+
it("returns the original sdp if the browserName is firefox", () => {
76+
jest.mock("webrtc-adapter", () => ({
77+
browserDetails: {
78+
browser: "firefox",
79+
},
80+
}));
81+
const sdp = getVideoSdpString();
82+
83+
const modifiedSdp = sdpModifier.enableIceRenomination(sdp);
84+
85+
expect(modifiedSdp).toEqual(sdp);
86+
});
87+
7188
it("returns the original sdp if it has no ice-options:tickle", () => {
7289
const sdp = getVideoSdpString();
7390

0 commit comments

Comments
 (0)