Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support empty <format specific parameters> in a=fmtp: line #15

Merged
merged 3 commits into from
Nov 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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