Skip to content

Commit

Permalink
added a=label attributes to combined SDP if no present
Browse files Browse the repository at this point in the history
  • Loading branch information
davehorton committed Dec 13, 2018
1 parent 72d112e commit 72c2534
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/payload-combiner.js
Expand Up @@ -2,7 +2,9 @@ module.exports = function(sdp1, sdp2) {
const arr1 = /^([^]+)(c=[^]+)t=[^]+(m=[^]+?)(a=[^]+)$/.exec(sdp1) ;
const arr2 = /^([^]+)(c=[^]+)t=[^]+(m=[^]+?)(a=[^]+)$/.exec(sdp2) ;

const combinedSdp = `${arr1[1]}t=0 0\r\n${arr1[2]}${arr1[3]}${arr1[4]}${arr2[3]}${arr2[4]}`
const aLabel = sdp1.includes('a=label:') ? '' : 'a=label:1\r\n';
const bLabel = sdp2.includes('a=label:') ? '' : 'a=label:2\r\n';
const combinedSdp = `${arr1[1]}t=0 0\r\n${arr1[2]}${arr1[3]}${arr1[4]}${aLabel}${arr2[3]}${arr2[4]}${bLabel}`
.replace(/a=sendonly\r\n/g, '')
.replace(/a=direction:both\r\n/g, '');

Expand Down

0 comments on commit 72c2534

Please sign in to comment.