|
|
@@ -338,7 +338,10 @@ export default class JingleSessionPC extends JingleSession {
|
|
338
|
338
|
= browser.supportsUnifiedPlan()
|
|
339
|
339
|
&& (browser.isFirefox()
|
|
340
|
340
|
|| browser.isWebKitBased()
|
|
341
|
|
- || (!this.isP2P && browser.isChromiumBased() && options.enableUnifiedOnChrome));
|
|
|
341
|
+ || (browser.isChromiumBased()
|
|
|
342
|
+
|
|
|
343
|
+ // Provide a way to control the behavior for jvb and p2p connections independently.
|
|
|
344
|
+ && this.isP2P ? options.p2p?.enableUnifiedOnChrome : options.enableUnifiedOnChrome));
|
|
342
|
345
|
|
|
343
|
346
|
if (this.isP2P) {
|
|
344
|
347
|
// simulcast needs to be disabled for P2P (121) calls
|
|
|
@@ -1586,6 +1589,7 @@ export default class JingleSessionPC extends JingleSession {
|
|
1586
|
1589
|
*/
|
|
1587
|
1590
|
_parseSsrcInfoFromSourceAdd(sourceAddElem, currentRemoteSdp) {
|
|
1588
|
1591
|
const addSsrcInfo = [];
|
|
|
1592
|
+ const self = this;
|
|
1589
|
1593
|
|
|
1590
|
1594
|
$(sourceAddElem).each((i1, content) => {
|
|
1591
|
1595
|
const name = $(content).attr('name');
|
|
|
@@ -1605,10 +1609,8 @@ export default class JingleSessionPC extends JingleSession {
|
|
1605
|
1609
|
})
|
|
1606
|
1610
|
.get();
|
|
1607
|
1611
|
|
|
1608
|
|
- if (ssrcs.length) {
|
|
1609
|
|
- lines
|
|
1610
|
|
- += `a=ssrc-group:${semantics} ${
|
|
1611
|
|
- ssrcs.join(' ')}\r\n`;
|
|
|
1612
|
+ if (ssrcs.length && !currentRemoteSdp.containsSSRC(ssrcs[0])) {
|
|
|
1613
|
+ lines += `a=ssrc-group:${semantics} ${ssrcs.join(' ')}\r\n`;
|
|
1612
|
1614
|
}
|
|
1613
|
1615
|
});
|
|
1614
|
1616
|
|
|
|
@@ -1622,7 +1624,10 @@ export default class JingleSessionPC extends JingleSession {
|
|
1622
|
1624
|
const ssrc = $(this).attr('ssrc');
|
|
1623
|
1625
|
|
|
1624
|
1626
|
if (currentRemoteSdp.containsSSRC(ssrc)) {
|
|
1625
|
|
- logger.warn(`${this} Source-add request for existing SSRC: ${ssrc}`);
|
|
|
1627
|
+
|
|
|
1628
|
+ // Do not print the warning for unified plan p2p case since ssrcs are never removed from the SDP.
|
|
|
1629
|
+ !(self.usesUnifiedPlan && self.isP2P)
|
|
|
1630
|
+ && logger.warn(`${self} Source-add request for existing SSRC: ${ssrc}`);
|
|
1626
|
1631
|
|
|
1627
|
1632
|
return;
|
|
1628
|
1633
|
}
|
|
|
@@ -1820,7 +1825,17 @@ export default class JingleSessionPC extends JingleSession {
|
|
1820
|
1825
|
const mid = remoteSdp.media.findIndex(mLine => mLine.includes(line));
|
|
1821
|
1826
|
|
|
1822
|
1827
|
if (mid > -1) {
|
|
1823
|
|
- remoteSdp.media[mid] = remoteSdp.media[mid].replace(`${line}\r\n`, '');
|
|
|
1828
|
+ // Remove the ssrcs from the m-line in
|
|
|
1829
|
+ // 1. Plan-b mode always.
|
|
|
1830
|
+ // 2. Unified mode but only for jvb connection. In p2p mode if the ssrc is removed and added
|
|
|
1831
|
+ // back to the same m-line, Chrome/Safari do not render the media even if it being received
|
|
|
1832
|
+ // and decoded from the remote peer. The webrtc spec is not clear about m-line re-use and
|
|
|
1833
|
+ // the browser vendors have implemented this differently. Currently workaround this by changing
|
|
|
1834
|
+ // the media direction, that should be enough for the browser to fire the "removetrack" event
|
|
|
1835
|
+ // on the associated MediaStream.
|
|
|
1836
|
+ if (!this.usesUnifiedPlan || (this.usesUnifiedPlan && !this.isP2P)) {
|
|
|
1837
|
+ remoteSdp.media[mid] = remoteSdp.media[mid].replace(`${line}\r\n`, '');
|
|
|
1838
|
+ }
|
|
1824
|
1839
|
|
|
1825
|
1840
|
// The current direction of the transceiver for p2p will depend on whether a local sources is
|
|
1826
|
1841
|
// added or not. It will be 'sendrecv' if the local source is present, 'sendonly' otherwise.
|
|
|
@@ -1866,8 +1881,8 @@ export default class JingleSessionPC extends JingleSession {
|
|
1866
|
1881
|
addSsrcInfo.forEach((lines, idx) => {
|
|
1867
|
1882
|
remoteSdp.media[idx] += lines;
|
|
1868
|
1883
|
|
|
1869
|
|
- // Make sure to change the direction to 'sendrecv' only for p2p connections. For jvb connections, a new
|
|
1870
|
|
- // m-line is added for the new remote sources.
|
|
|
1884
|
+ // Make sure to change the direction to 'sendrecv/sendonly' only for p2p connections. For jvb connections,
|
|
|
1885
|
+ // a new m-line is added for the new remote sources.
|
|
1871
|
1886
|
if (this.isP2P && this.usesUnifiedPlan) {
|
|
1872
|
1887
|
const mediaType = SDPUtil.parseMLine(remoteSdp.media[idx].split('\r\n')[0])?.media;
|
|
1873
|
1888
|
const desiredDirection = this.peerconnection.getDesiredMediaDirection(mediaType, true);
|