// Munge the offer: insert a duplicate video m-line at the application m-line
// position. This displaces the application section and creates a media type
// mismatch at that index, testing that we reject invalid type changes.
const sdpLines = offer.sdp.split("\r\n");
let mLineCount = 0;
let insertIndex = -1;
for (let i = 0; i < sdpLines.length; i++) {
if (sdpLines[i].startsWith("m=")) {
mLineCount++;
if (mLineCount === 2) {
insertIndex = i;
}
}
}
// Duplicate the second m-line section with a changed MID
if (insertIndex !== -1) {
let endIndex = insertIndex + 1;
for (let i = insertIndex + 1; i < sdpLines.length; i++) {
if (sdpLines[i].startsWith("m=")) {
endIndex = i;
break;
}
}
if (endIndex === sdpLines.length) endIndex = sdpLines.length;
const mlineSection = sdpLines.slice(insertIndex, endIndex);
// Change the MID in the copied section
for (let i = 0; i < mlineSection.length; i++) {
if (mlineSection[i].startsWith("a=mid:")) {
mlineSection[i] = "a=mid:changed-mid";
break;
}
}
sdpLines.splice(endIndex, 0, ...mlineSection);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.