|
@@ -1875,6 +1875,8 @@ export default class JingleSessionPC extends JingleSession {
|
1875
|
1875
|
const mid = remoteSdp.media.findIndex(mLine => mLine.includes(line));
|
1876
|
1876
|
|
1877
|
1877
|
if (mid > -1) {
|
|
1878
|
+ const mediaType = SDPUtil.parseMLine(remoteSdp.media[mid].split('\r\n')[0])?.media;
|
|
1879
|
+
|
1878
|
1880
|
if (this.isP2P) {
|
1879
|
1881
|
// Do not remove ssrcs from m-line in p2p mode. If the ssrc is removed and added back to
|
1880
|
1882
|
// the same m-line (on source-add), Chrome/Safari do not render the media even if it is
|
|
@@ -1884,7 +1886,6 @@ export default class JingleSessionPC extends JingleSession {
|
1884
|
1886
|
// fire the "removetrack" event on the associated MediaStream. Also, the current direction
|
1885
|
1887
|
// of the transceiver for p2p will depend on whether a local sources is added or not. It
|
1886
|
1888
|
// will be 'sendrecv' if the local source is present, 'sendonly' otherwise.
|
1887
|
|
- const mediaType = SDPUtil.parseMLine(remoteSdp.media[mid].split('\r\n')[0])?.media;
|
1888
|
1889
|
const desiredDirection = this.peerconnection.getDesiredMediaDirection(mediaType, false);
|
1889
|
1890
|
|
1890
|
1891
|
[ MediaDirection.SENDRECV, MediaDirection.SENDONLY ].forEach(direction => {
|
|
@@ -1892,10 +1893,14 @@ export default class JingleSessionPC extends JingleSession {
|
1892
|
1893
|
.replace(`a=${direction}`, `a=${desiredDirection}`);
|
1893
|
1894
|
});
|
1894
|
1895
|
} else {
|
1895
|
|
- // Jvb connections will have direction set to 'sendonly' for the remote sources.
|
|
1896
|
+ // Change the port to 0 to reject the m-line associated with the source. The rejected
|
|
1897
|
+ // m-lines are recycled when new ssrcs need to be added to the remote description.
|
|
1898
|
+ const port = SDPUtil.parseMLine(remoteSdp.media[mid].split('\r\n')[0])?.port;
|
|
1899
|
+
|
1896
|
1900
|
remoteSdp.media[mid] = remoteSdp.media[mid].replace(`${line}\r\n`, '');
|
1897
|
|
- remoteSdp.media[mid] = remoteSdp.media[mid]
|
1898
|
|
- .replace(`a=${MediaDirection.SENDONLY}`, `a=${MediaDirection.INACTIVE}`);
|
|
1901
|
+ remoteSdp.media[mid] = remoteSdp.media[mid].replace(
|
|
1902
|
+ `m=${mediaType} ${port}`,
|
|
1903
|
+ `m=${mediaType} 0`);
|
1899
|
1904
|
}
|
1900
|
1905
|
}
|
1901
|
1906
|
});
|