Skip to content

Commit 763b2c8

Browse files
authored
fix(SDP) Do not filter out SSRC 'cname' attributes. (#2695)
* fix(SDP) Do not filter out SSRC 'cname' attributes. Chrome doesn't generate the a=ssrc line with 'msid' attribute when the track is removed from pc and a renegotiation is triggered. As a result a source-remove is sent to the p2p peer when it shouldn't be causing issues on the receiver when the same source is added back to the conference. Fixes toggleCamera on mobile browser not working as expected.
1 parent 2b08716 commit 763b2c8

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

modules/sdp/LocalSdpMunger.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,15 @@ export default class LocalSdpMunger {
9696
}
9797
}
9898

99-
// Ignore the 'cname', 'label' and 'mslabel' attributes.
100-
mediaSection.ssrcs = mediaSection.ssrcs
101-
.filter(ssrc => ssrc.attribute === 'msid' || ssrc.attribute === 'name' || ssrc.attribute === 'videoType');
99+
// Ignore the 'label' and 'mslabel' attributes.
100+
mediaSection.ssrcs
101+
= mediaSection.ssrcs.filter(ssrc => ssrc.attribute !== 'label' && ssrc.attribute !== 'mslabel');
102+
103+
// Remove the 'cname' attribute on Firefox as a=ssrc line with only 'cname' attribute are present in the SDP
104+
// for recvonly SSRCs generated by createAnswer. These do not have to be signaled to the peers.
105+
if (browser.isFirefox()) {
106+
mediaSection.ssrcs = mediaSection.ssrcs.filter(ssrc => ssrc.attribute !== 'cname');
107+
}
102108

103109
// On FF when the user has started muted create answer will generate a recv only SSRC. We don't want to signal
104110
// this SSRC in order to reduce the load of the xmpp server for large calls. Therefore the SSRC needs to be

modules/sdp/LocalSdpMunger.spec.js

+3-20
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,7 @@ describe('TransformSdpsForUnifiedPlan', () => {
2828
localSdpMunger = new LocalSdpMunger(tpc, localEndpointId);
2929
});
3030
describe('StripSsrcs', () => {
31-
it('should strip ssrcs from an sdp with no msid (i.e., recvonly transceivers)', () => {
32-
localSdpMunger.tpc.isP2P = false;
33-
34-
const sdpStr = transform.write(SampleSdpStrings.recvOnlySdp);
35-
const desc = new RTCSessionDescription({
36-
type: 'offer',
37-
sdp: sdpStr
38-
});
39-
const transformedDesc = localSdpMunger.transformStreamIdentifiers(desc, {});
40-
const newSdp = transform.parse(transformedDesc.sdp);
41-
const audioSsrcs = getSsrcLines(newSdp, 'audio');
42-
const videoSsrcs = getSsrcLines(newSdp, 'video');
43-
44-
expect(audioSsrcs.length).toEqual(0);
45-
expect(videoSsrcs.length).toEqual(0);
46-
});
47-
48-
describe('should strip cname, label and mslabel from an sdp with msid', () => {
31+
describe('should strip label and mslabel from an sdp with msid', () => {
4932
let audioSsrcs, videoSsrcs;
5033

5134
const transformStreamIdentifiers = () => {
@@ -77,8 +60,8 @@ describe('TransformSdpsForUnifiedPlan', () => {
7760
it('with source name signaling enabled (injected source name)', () => {
7861
transformStreamIdentifiers();
7962

80-
expect(audioSsrcs.length).toEqual(1 + 1 /* injected source name */);
81-
expect(videoSsrcs.length).toEqual(3 + 3 /* injected source name into each ssrc */);
63+
expect(audioSsrcs.length).toEqual(2 + 1 /* injected source name */);
64+
expect(videoSsrcs.length).toEqual(6 + 3 /* injected source name into each ssrc */);
8265
});
8366
});
8467
});

0 commit comments

Comments
 (0)