From b9565a0b973b3f64034f8f3b1e2d5817d4bf55b6 Mon Sep 17 00:00:00 2001 From: Kieran Kunhya Date: Tue, 2 Aug 2022 15:25:07 +0000 Subject: [PATCH] checkST2110: Add stricter a=mid position verification --- checkST2110.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/checkST2110.js b/checkST2110.js index c9bb436..e3b45fb 100644 --- a/checkST2110.js +++ b/checkST2110.js @@ -294,12 +294,23 @@ const test_10_83_3 = sdp => { } } let doneOne = false; + let firstMid = false; for ( let x = 0 ; x < lines.length ; x++ ) { if (lines[x].startsWith('m=')) { if (!doneOne) { errors.push(new Error(`Got to line ${x + 1}, the end of session-level description, without finding the destination group, with reference to RFC 7104.`)); } - break; + + if (firstMid == true && !lines[x-1].startsWith('a=mid')) { + errors.push(new Error(`Line ${x+1} "m=" should be preceded by "a=mid" on the previous line" `)); + } + + firstMid = true; + } + if (x == lines.length-1) { + if (!lines[x].startsWith('a=mid:')) { + errors.push(new Error(`Line ${x+1} - final line should contain a=mid" `)); + } } if (!lines[x].startsWith('a=group')) { continue;