Skip to content

Commit

Permalink
Merge pull request #15 from AMWA-TV/garethsb-patch-fmtp
Browse files Browse the repository at this point in the history
Support empty <format specific parameters> in a=fmtp: line
  • Loading branch information
garethsb authored Nov 11, 2022
2 parents 2f2acdd + 9f9faf0 commit fc1090b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions checkST2110.js
Original file line number Diff line number Diff line change
Expand Up @@ -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*))?$/;
Expand Down Expand Up @@ -492,11 +492,10 @@ 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 = [];
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) {
Expand Down

0 comments on commit fc1090b

Please sign in to comment.