|
|
@@ -1697,6 +1697,8 @@ export default class JingleSessionPC extends JingleSession {
|
|
1697
|
1697
|
});
|
|
1698
|
1698
|
});
|
|
1699
|
1699
|
|
|
|
1700
|
+ let midFound = false;
|
|
|
1701
|
+
|
|
1700
|
1702
|
/* eslint-enable no-invalid-this */
|
|
1701
|
1703
|
currentRemoteSdp.media.forEach((media, i2) => {
|
|
1702
|
1704
|
if (!SDPUtil.findLine(media, `a=mid:${name}`)) {
|
|
|
@@ -1706,7 +1708,14 @@ export default class JingleSessionPC extends JingleSession {
|
|
1706
|
1708
|
addSsrcInfo[i2] = '';
|
|
1707
|
1709
|
}
|
|
1708
|
1710
|
addSsrcInfo[i2] += lines;
|
|
|
1711
|
+ midFound = true;
|
|
1709
|
1712
|
});
|
|
|
1713
|
+
|
|
|
1714
|
+ // In p2p unified mode with multi-stream enabled, the new sources will have content name that doesn't exist
|
|
|
1715
|
+ // in the current remote description. Add a new m-line for this newly signaled source.
|
|
|
1716
|
+ if (!midFound && this.isP2P && FeatureFlags.isSourceNameSignalingEnabled()) {
|
|
|
1717
|
+ addSsrcInfo[name] = lines;
|
|
|
1718
|
+ }
|
|
1710
|
1719
|
});
|
|
1711
|
1720
|
|
|
1712
|
1721
|
return addSsrcInfo;
|
|
|
@@ -1929,8 +1938,17 @@ export default class JingleSessionPC extends JingleSession {
|
|
1929
|
1938
|
* in removeSsrcInfo
|
|
1930
|
1939
|
*/
|
|
1931
|
1940
|
_processRemoteAddSource(addSsrcInfo) {
|
|
1932
|
|
- const remoteSdp = new SDP(this.peerconnection.remoteDescription.sdp);
|
|
1933
|
|
-
|
|
|
1941
|
+ let remoteSdp = new SDP(this.peerconnection.remoteDescription.sdp);
|
|
|
1942
|
+
|
|
|
1943
|
+ // Add a new m-line in the remote description if the source info for a secondary video source is recceived from
|
|
|
1944
|
+ // the remote p2p peer when multi-stream support is enabled.
|
|
|
1945
|
+ if (addSsrcInfo.length > remoteSdp.media.length
|
|
|
1946
|
+ && FeatureFlags.isSourceNameSignalingEnabled()
|
|
|
1947
|
+ && this.isP2P
|
|
|
1948
|
+ && this.usesUnifiedPlan) {
|
|
|
1949
|
+ remoteSdp.addMlineForNewLocalSource(MediaType.VIDEO);
|
|
|
1950
|
+ remoteSdp = new SDP(remoteSdp.raw);
|
|
|
1951
|
+ }
|
|
1934
|
1952
|
addSsrcInfo.forEach((lines, idx) => {
|
|
1935
|
1953
|
remoteSdp.media[idx] += lines;
|
|
1936
|
1954
|
|
|
|
@@ -2635,17 +2653,18 @@ export default class JingleSessionPC extends JingleSession {
|
|
2635
|
2653
|
sid: this.sid
|
|
2636
|
2654
|
}
|
|
2637
|
2655
|
);
|
|
2638
|
|
- const removedAnySSRCs = sdpDiffer.toJingle(remove);
|
|
|
2656
|
+
|
|
|
2657
|
+ sdpDiffer.toJingle(remove);
|
|
2639
|
2658
|
|
|
2640
|
2659
|
// context a common object for one run of ssrc update (source-add and source-remove) so we can match them if we
|
|
2641
|
2660
|
// need to
|
|
2642
|
2661
|
const ctx = {};
|
|
|
2662
|
+ const removedSsrcInfo = getSignaledSourceInfo(sdpDiffer);
|
|
2643
|
2663
|
|
|
2644
|
|
- if (removedAnySSRCs) {
|
|
2645
|
|
- const sourceInfo = getSignaledSourceInfo(sdpDiffer);
|
|
2646
|
|
-
|
|
|
2664
|
+ if (removedSsrcInfo.ssrcs.length) {
|
|
2647
|
2665
|
// Log only the SSRCs instead of the full IQ.
|
|
2648
|
|
- logger.info(`${this} Sending source-remove for ${sourceInfo.mediaType} ssrcs=${sourceInfo.ssrcs}`);
|
|
|
2666
|
+ logger.info(`${this} Sending source-remove for ${removedSsrcInfo.mediaType}`
|
|
|
2667
|
+ + ` ssrcs=${removedSsrcInfo.ssrcs}`);
|
|
2649
|
2668
|
this.connection.sendIQ(
|
|
2650
|
2669
|
remove,
|
|
2651
|
2670
|
() => {
|
|
|
@@ -2669,20 +2688,19 @@ export default class JingleSessionPC extends JingleSession {
|
|
2669
|
2688
|
}
|
|
2670
|
2689
|
);
|
|
2671
|
2690
|
|
|
2672
|
|
- const containsNewSSRCs = sdpDiffer.toJingle(add);
|
|
2673
|
|
-
|
|
2674
|
|
- if (containsNewSSRCs) {
|
|
2675
|
|
- const sourceInfo = getSignaledSourceInfo(sdpDiffer);
|
|
|
2691
|
+ sdpDiffer.toJingle(add);
|
|
|
2692
|
+ const addedSsrcInfo = getSignaledSourceInfo(sdpDiffer);
|
|
2676
|
2693
|
|
|
|
2694
|
+ if (addedSsrcInfo.ssrcs.length) {
|
|
2677
|
2695
|
// Log only the SSRCs instead of the full IQ.
|
|
2678
|
|
- logger.info(`${this} Sending source-add for ${sourceInfo.mediaType} ssrcs=${sourceInfo.ssrcs}`);
|
|
|
2696
|
+ logger.info(`${this} Sending source-add for ${addedSsrcInfo.mediaType} ssrcs=${addedSsrcInfo.ssrcs}`);
|
|
2679
|
2697
|
this.connection.sendIQ(
|
|
2680
|
2698
|
add,
|
|
2681
|
2699
|
() => {
|
|
2682
|
2700
|
this.room.eventEmitter.emit(XMPPEvents.SOURCE_ADD, this, ctx);
|
|
2683
|
2701
|
},
|
|
2684
|
2702
|
this.newJingleErrorHandler(add, error => {
|
|
2685
|
|
- this.room.eventEmitter.emit(XMPPEvents.SOURCE_ADD_ERROR, this, error, sourceInfo.mediaType, ctx);
|
|
|
2703
|
+ this.room.eventEmitter.emit(XMPPEvents.SOURCE_ADD_ERROR, this, error, addedSsrcInfo.mediaType, ctx);
|
|
2686
|
2704
|
}),
|
|
2687
|
2705
|
IQ_TIMEOUT);
|
|
2688
|
2706
|
}
|