|
@@ -1047,7 +1047,8 @@ function extractSSRCMap(desc) {
|
1047
|
1047
|
|
1048
|
1048
|
/**
|
1049
|
1049
|
* Takes a SessionDescription object and returns a "normalized" version.
|
1050
|
|
- * Currently it only takes care of ordering the a=ssrc lines.
|
|
1050
|
+ * Currently it takes care of ordering the a=ssrc lines and denoting receive
|
|
1051
|
+ * only SSRCs.
|
1051
|
1052
|
*/
|
1052
|
1053
|
const normalizePlanB = function(desc) {
|
1053
|
1054
|
if (typeof desc !== 'object' || desc === null
|
|
@@ -1106,7 +1107,7 @@ const normalizePlanB = function(desc) {
|
1106
|
1107
|
}
|
1107
|
1108
|
}
|
1108
|
1109
|
|
1109
|
|
- mLine.ssrcs = newSsrcLines;
|
|
1110
|
+ mLine.ssrcs = replaceDefaultUnifiedPlanMsid(newSsrcLines);
|
1110
|
1111
|
}
|
1111
|
1112
|
});
|
1112
|
1113
|
}
|
|
@@ -1120,6 +1121,48 @@ const normalizePlanB = function(desc) {
|
1120
|
1121
|
});
|
1121
|
1122
|
};
|
1122
|
1123
|
|
|
1124
|
+/**
|
|
1125
|
+ * Unified plan differentiates a remote track not associated with a stream using
|
|
1126
|
+ * the msid "-", which can incorrectly trigger an onaddstream event in plan-b.
|
|
1127
|
+ * For jitsi, these tracks are actually receive-only ssrcs. To prevent
|
|
1128
|
+ * onaddstream from firing, remove the ssrcs with msid "-" except the cname
|
|
1129
|
+ * line. Normally the ssrcs are not used by the client, as the bridge controls
|
|
1130
|
+ * media flow, but keep one reference to the ssrc for the p2p case.
|
|
1131
|
+ *
|
|
1132
|
+ * @param {Array<Object>} ssrcLines - The ssrc lines from a remote description.
|
|
1133
|
+ * @private
|
|
1134
|
+ * @returns {Array<Object>} ssrcLines with removed lines referencing msid "-".
|
|
1135
|
+ */
|
|
1136
|
+function replaceDefaultUnifiedPlanMsid(ssrcLines = []) {
|
|
1137
|
+ if (!browser.isChrome() || !browser.isVersionGreaterThan(70)) {
|
|
1138
|
+ return ssrcLines;
|
|
1139
|
+ }
|
|
1140
|
+
|
|
1141
|
+ let filteredLines = [ ...ssrcLines ];
|
|
1142
|
+
|
|
1143
|
+ const problematicSsrcIds = ssrcLines.filter(ssrcLine =>
|
|
1144
|
+ ssrcLine.attribute === 'mslabel' && ssrcLine.value === '-')
|
|
1145
|
+ .map(ssrcLine => ssrcLine.id);
|
|
1146
|
+
|
|
1147
|
+ problematicSsrcIds.forEach(ssrcId => {
|
|
1148
|
+ // Find the cname which is to be modified and left in.
|
|
1149
|
+ const cnameLine = filteredLines.find(line =>
|
|
1150
|
+ line.id === ssrcId && line.attribute === 'cname');
|
|
1151
|
+
|
|
1152
|
+ cnameLine.value = `recvonly-${ssrcId}`;
|
|
1153
|
+
|
|
1154
|
+ // Remove all of lines for the ssrc.
|
|
1155
|
+ filteredLines
|
|
1156
|
+ = filteredLines.filter(line => line.id !== ssrcId);
|
|
1157
|
+
|
|
1158
|
+ // But re-add the cname line so there is a reference kept to the ssrc
|
|
1159
|
+ // in the SDP.
|
|
1160
|
+ filteredLines.push(cnameLine);
|
|
1161
|
+ });
|
|
1162
|
+
|
|
1163
|
+ return filteredLines;
|
|
1164
|
+}
|
|
1165
|
+
|
1123
|
1166
|
/**
|
1124
|
1167
|
* Makes sure that both audio and video directions are configured as 'sendrecv'.
|
1125
|
1168
|
* @param {Object} localDescription the SDP object as defined by WebRTC.
|