|
@@ -1885,8 +1885,10 @@ export default class JingleSessionPC extends JingleSession {
|
1885
|
1885
|
lines = lines.split('\r\n');
|
1886
|
1886
|
lines.pop(); // remove empty last element;
|
1887
|
1887
|
if (this.usesUnifiedPlan) {
|
|
1888
|
+ let mid;
|
|
1889
|
+
|
1888
|
1890
|
lines.forEach(line => {
|
1889
|
|
- const mid = remoteSdp.media.findIndex(mLine => mLine.includes(line));
|
|
1891
|
+ mid = remoteSdp.media.findIndex(mLine => mLine.includes(line));
|
1890
|
1892
|
|
1891
|
1893
|
if (mid > -1) {
|
1892
|
1894
|
remoteSdp.media[mid] = remoteSdp.media[mid].replace(`${line}\r\n`, '');
|
|
@@ -1905,6 +1907,15 @@ export default class JingleSessionPC extends JingleSession {
|
1905
|
1907
|
}
|
1906
|
1908
|
}
|
1907
|
1909
|
});
|
|
1910
|
+
|
|
1911
|
+ // Reject the m-line so that the browser removes the associated transceiver from the list of available
|
|
1912
|
+ // transceivers. This will prevent the client from trying to re-use these inactive transceivers when
|
|
1913
|
+ // additional video sources are added to the peerconnection.
|
|
1914
|
+ if (mid > -1 && !this.isP2P && FeatureFlags.isMultiStreamSupportEnabled()) {
|
|
1915
|
+ const { media, port } = SDPUtil.parseMLine(remoteSdp.media[mid].split('\r\n')[0]);
|
|
1916
|
+
|
|
1917
|
+ remoteSdp.media[mid] = remoteSdp.media[mid].replace(`m=${media} ${port}`, `m=${media} 0`);
|
|
1918
|
+ }
|
1908
|
1919
|
} else {
|
1909
|
1920
|
lines.forEach(line => {
|
1910
|
1921
|
remoteSdp.media[idx] = remoteSdp.media[idx].replace(`${line}\r\n`, '');
|
|
@@ -2049,6 +2060,7 @@ export default class JingleSessionPC extends JingleSession {
|
2049
|
2060
|
|
2050
|
2061
|
const replaceTracks = [];
|
2051
|
2062
|
const workFunction = finishedCallback => {
|
|
2063
|
+ const oldLocalSDP = new SDP(this.peerconnection.localDescription.sdp);
|
2052
|
2064
|
const remoteSdp = new SDP(this.peerconnection.peerconnection.remoteDescription.sdp);
|
2053
|
2065
|
|
2054
|
2066
|
// Add transceivers by adding a new mline in the remote description for each track.
|
|
@@ -2056,14 +2068,33 @@ export default class JingleSessionPC extends JingleSession {
|
2056
|
2068
|
remoteSdp.addMlineForNewLocalSource(track.getType());
|
2057
|
2069
|
}
|
2058
|
2070
|
|
2059
|
|
- // Always initiate a responder renegotiate since the new m-line is added to remote SDP.
|
2060
|
2071
|
const remoteDescription = new RTCSessionDescription({
|
2061
|
2072
|
type: 'offer',
|
2062
|
2073
|
sdp: remoteSdp.raw
|
2063
|
2074
|
});
|
2064
|
2075
|
|
|
2076
|
+ // Always initiate a responder renegotiate since the new m-line is added to remote SDP.
|
2065
|
2077
|
this._responderRenegotiate(remoteDescription)
|
2066
|
|
- .then(() => finishedCallback(), error => finishedCallback(error));
|
|
2078
|
+ .then(() => {
|
|
2079
|
+ // Replace the tracks on the newly generated transceivers.
|
|
2080
|
+ for (const track of localTracks) {
|
|
2081
|
+ replaceTracks.push(this.peerconnection.replaceTrack(null, track));
|
|
2082
|
+ }
|
|
2083
|
+
|
|
2084
|
+ return Promise.all(replaceTracks);
|
|
2085
|
+ })
|
|
2086
|
+
|
|
2087
|
+ // Trigger a renegotiation here since renegotiations are suppressed at TPC.replaceTrack for screenshare
|
|
2088
|
+ // tracks. This is done here so that presence for screenshare tracks is sent before signaling.
|
|
2089
|
+ .then(() => this._renegotiate())
|
|
2090
|
+ .then(() => {
|
|
2091
|
+ const newLocalSDP = new SDP(this.peerconnection.localDescription.sdp);
|
|
2092
|
+
|
|
2093
|
+ // Signal the new sources to the peer.
|
|
2094
|
+ this.notifyMySSRCUpdate(oldLocalSDP, newLocalSDP);
|
|
2095
|
+ finishedCallback();
|
|
2096
|
+ })
|
|
2097
|
+ .catch(error => finishedCallback(error));
|
2067
|
2098
|
};
|
2068
|
2099
|
|
2069
|
2100
|
return new Promise((resolve, reject) => {
|
|
@@ -2077,15 +2108,7 @@ export default class JingleSessionPC extends JingleSession {
|
2077
|
2108
|
reject(error);
|
2078
|
2109
|
} else {
|
2079
|
2110
|
logger.debug(`${this} renegotiation after addTrack executed - OK`);
|
2080
|
|
-
|
2081
|
|
- // Replace the tracks on the newly generated transceivers.
|
2082
|
|
- for (const track of localTracks) {
|
2083
|
|
- replaceTracks.push(this.replaceTrack(null, track));
|
2084
|
|
- }
|
2085
|
|
-
|
2086
|
|
- return Promise.all(replaceTracks)
|
2087
|
|
- .then(() => resolve())
|
2088
|
|
- .catch(() => reject());
|
|
2111
|
+ resolve();
|
2089
|
2112
|
}
|
2090
|
2113
|
});
|
2091
|
2114
|
});
|