From d5f1db0d46b89151c2469b796e2c4565390e0ba7 Mon Sep 17 00:00:00 2001 From: Gareth Sylvester-Bradley Date: Fri, 26 Aug 2022 12:50:39 +0100 Subject: [PATCH 1/3] Support empty in a=fmtp: line --- checkST2110.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkST2110.js b/checkST2110.js index c9bb436..e9f3971 100644 --- a/checkST2110.js +++ b/checkST2110.js @@ -30,7 +30,7 @@ const videoPattern = /video\s+(\d+)(\/\d+)?\s+(RTP\/S?AVP)\s+(\d+)/; const rtpmapPattern = /a=rtpmap:(\d+)\s(\S+)\/(\d+)\s*/; const fmtpElement = '([^\\s=;]+)(?:=([^\\s;]+))?'; const fmtpSeparator = '(?:;\\s*)'; -const fmtpPattern = new RegExp('a=fmtp:(\\d+)\\s+' + fmtpElement + '(' + fmtpSeparator + fmtpElement + ')*' + fmtpSeparator + '?$'); +const fmtpPattern = new RegExp('a=fmtp:(\\d+)\\s*(\\s' + fmtpElement + '(' + fmtpSeparator + fmtpElement + ')*' + fmtpSeparator + '?)?$'); const fmtpParams = new RegExp(fmtpElement + fmtpSeparator + '?', 'g'); const integerPattern = /^[1-9]\d*$/; const frameRatePattern = /^([1-9]\d*)(?:\/([1-9]\d*))?$/; From d3de8d52d83c74643364459eca575ca0c0b6d22b Mon Sep 17 00:00:00 2001 From: Gareth Sylvester-Bradley Date: Fri, 26 Aug 2022 13:09:16 +0100 Subject: [PATCH 2/3] Fix 'params' name hiding! --- checkST2110.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/checkST2110.js b/checkST2110.js index e9f3971..6027b18 100644 --- a/checkST2110.js +++ b/checkST2110.js @@ -492,11 +492,11 @@ const extractMTParams = (sdp, params = {}) => { if (!fmtpPattern.test(lines[x])) { continue; } - let params = lines[x].split(/a=fmtp:\d+\s+/)[1]; - // let paramsMatch = params.matchAll(fmtpParams); + let fmtParams = lines[x].split(/a=fmtp:\d+\s+/)[1]; + // let paramsMatch = fmtParams.matchAll(fmtpParams); let paramsMatch = []; let paramMatch; - while ((paramMatch = fmtpParams.exec(params)) !== null) + while ((paramMatch = fmtpParams.exec(fmtParams)) !== null) paramsMatch.push(paramMatch); let splitParams = paramsMatch.map(p => [p[1], p[2] || '']); if (params.checkDups) { From 9f9faf057d3369e73886e0a9de056830520e8d1d Mon Sep 17 00:00:00 2001 From: Gareth Sylvester-Bradley Date: Fri, 11 Nov 2022 13:33:41 +0000 Subject: [PATCH 3/3] Apply suggestion from code review --- checkST2110.js | 1 - 1 file changed, 1 deletion(-) diff --git a/checkST2110.js b/checkST2110.js index 6027b18..84d302d 100644 --- a/checkST2110.js +++ b/checkST2110.js @@ -493,7 +493,6 @@ const extractMTParams = (sdp, params = {}) => { continue; } let fmtParams = lines[x].split(/a=fmtp:\d+\s+/)[1]; - // let paramsMatch = fmtParams.matchAll(fmtpParams); let paramsMatch = []; let paramMatch; while ((paramMatch = fmtpParams.exec(fmtParams)) !== null)