Skip to content
Snippets Groups Projects
Commit 70fe159c authored by Chad Pilkey's avatar Chad Pilkey
Browse files

ensure that media.candidates exists before stripping mDNS candidates

parent 67ca66c8
No related branches found
No related tags found
No related merge requests found
......@@ -49,13 +49,15 @@ const stripMDnsCandidates = (sdp) => {
const parsedSDP = transform.parse(sdp);
let strippedCandidates = 0;
parsedSDP.media.forEach((media) => {
media.candidates = media.candidates.filter((candidate) => {
if (candidate.ip && candidate.ip.indexOf('.local') === -1) {
return true;
}
strippedCandidates += 1;
return false;
});
if (media.candidates) {
media.candidates = media.candidates.filter((candidate) => {
if (candidate.ip && candidate.ip.indexOf('.local') === -1) {
return true;
}
strippedCandidates += 1;
return false;
});
}
});
if (strippedCandidates > 0) {
logger.info({ logCode: 'sdp_utils_mdns_candidate_strip' }, `Stripped ${strippedCandidates} mDNS candidates`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment