|
@@ -49,15 +49,14 @@ SDP.prototype.removeUdpCandidates = false;
|
49
|
49
|
* Returns map of MediaChannel mapped per channel idx.
|
50
|
50
|
*/
|
51
|
51
|
SDP.prototype.getMediaSsrcMap = function() {
|
52
|
|
- const self = this;
|
53
|
52
|
const mediaSSRCs = {};
|
54
|
53
|
let tmp;
|
55
|
54
|
|
56
|
|
- for (let mediaindex = 0; mediaindex < self.media.length; mediaindex++) {
|
57
|
|
- tmp = SDPUtil.findLines(self.media[mediaindex], 'a=ssrc:');
|
|
55
|
+ for (let mediaindex = 0; mediaindex < this.media.length; mediaindex++) {
|
|
56
|
+ tmp = SDPUtil.findLines(this.media[mediaindex], 'a=ssrc:');
|
58
|
57
|
const mid
|
59
|
58
|
= SDPUtil.parseMID(
|
60
|
|
- SDPUtil.findLine(self.media[mediaindex], 'a=mid:'));
|
|
59
|
+ SDPUtil.findLine(this.media[mediaindex], 'a=mid:'));
|
61
|
60
|
const media = {
|
62
|
61
|
mediaindex,
|
63
|
62
|
mid,
|
|
@@ -79,7 +78,7 @@ SDP.prototype.getMediaSsrcMap = function() {
|
79
|
78
|
}
|
80
|
79
|
media.ssrcs[linessrc].lines.push(line);
|
81
|
80
|
});
|
82
|
|
- tmp = SDPUtil.findLines(self.media[mediaindex], 'a=ssrc-group:');
|
|
81
|
+ tmp = SDPUtil.findLines(this.media[mediaindex], 'a=ssrc-group:');
|
83
|
82
|
tmp.forEach(line => {
|
84
|
83
|
const idx = line.indexOf(' ');
|
85
|
84
|
const semantics = line.substr(0, idx).substr(13);
|
|
@@ -395,13 +394,12 @@ SDP.prototype.toJingle = function(elem, thecreator) {
|
395
|
394
|
|
396
|
395
|
SDP.prototype.transportToJingle = function(mediaindex, elem) {
|
397
|
396
|
let tmp;
|
398
|
|
- const self = this;
|
399
|
397
|
|
400
|
398
|
elem.c('transport');
|
401
|
399
|
|
402
|
400
|
// XEP-0343 DTLS/SCTP
|
403
|
401
|
const sctpmap
|
404
|
|
- = SDPUtil.findLine(this.media[mediaindex], 'a=sctpmap:', self.session);
|
|
402
|
+ = SDPUtil.findLine(this.media[mediaindex], 'a=sctpmap:', this.session);
|
405
|
403
|
|
406
|
404
|
if (sctpmap) {
|
407
|
405
|
const sctpAttrs = SDPUtil.parseSCTPMap(sctpmap);
|
|
@@ -435,9 +433,9 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
|
435
|
433
|
// eslint-disable-next-line no-param-reassign
|
436
|
434
|
line
|
437
|
435
|
= SDPUtil.findLine(
|
438
|
|
- self.media[mediaindex],
|
|
436
|
+ this.media[mediaindex],
|
439
|
437
|
'a=setup:',
|
440
|
|
- self.session);
|
|
438
|
+ this.session);
|
441
|
439
|
if (line) {
|
442
|
440
|
tmp.setup = line.substr(8);
|
443
|
441
|
}
|
|
@@ -460,7 +458,7 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
|
460
|
458
|
lines.forEach(line => {
|
461
|
459
|
const candidate = SDPUtil.candidateToJingle(line);
|
462
|
460
|
|
463
|
|
- if (self.failICE) {
|
|
461
|
+ if (this.failICE) {
|
464
|
462
|
candidate.ip = '1.1.1.1';
|
465
|
463
|
}
|
466
|
464
|
const protocol
|
|
@@ -468,9 +466,9 @@ SDP.prototype.transportToJingle = function(mediaindex, elem) {
|
468
|
466
|
? candidate.protocol.toLowerCase()
|
469
|
467
|
: '';
|
470
|
468
|
|
471
|
|
- if ((self.removeTcpCandidates
|
|
469
|
+ if ((this.removeTcpCandidates
|
472
|
470
|
&& (protocol === 'tcp' || protocol === 'ssltcp'))
|
473
|
|
- || (self.removeUdpCandidates && protocol === 'udp')) {
|
|
471
|
+ || (this.removeUdpCandidates && protocol === 'udp')) {
|
474
|
472
|
return;
|
475
|
473
|
}
|
476
|
474
|
elem.c('candidate', candidate).up();
|
|
@@ -538,7 +536,6 @@ SDP.prototype.rtcpFbFromJingle = function(elem, payloadtype) { // XEP-0293
|
538
|
536
|
|
539
|
537
|
// construct an SDP from a jingle stanza
|
540
|
538
|
SDP.prototype.fromJingle = function(jingle) {
|
541
|
|
- const self = this;
|
542
|
539
|
const sessionId = Date.now();
|
543
|
540
|
|
544
|
541
|
// Use a unique session id for every TPC.
|
|
@@ -561,7 +558,7 @@ SDP.prototype.fromJingle = function(jingle) {
|
561
|
558
|
.get();
|
562
|
559
|
|
563
|
560
|
if (contents.length > 0) {
|
564
|
|
- self.raw
|
|
561
|
+ this.raw
|
565
|
562
|
+= `a=group:${
|
566
|
563
|
group.getAttribute('semantics')
|
567
|
564
|
|| group.getAttribute('type')} ${
|
|
@@ -572,9 +569,9 @@ SDP.prototype.fromJingle = function(jingle) {
|
572
|
569
|
|
573
|
570
|
this.session = this.raw;
|
574
|
571
|
jingle.find('>content').each((_, content) => {
|
575
|
|
- const m = self.jingle2media($(content));
|
|
572
|
+ const m = this.jingle2media($(content));
|
576
|
573
|
|
577
|
|
- self.media.push(m);
|
|
574
|
+ this.media.push(m);
|
578
|
575
|
});
|
579
|
576
|
|
580
|
577
|
// reconstruct msid-semantic -- apparently not necessary
|
|
@@ -592,7 +589,6 @@ SDP.prototype.fromJingle = function(jingle) {
|
592
|
589
|
SDP.prototype.jingle2media = function(content) {
|
593
|
590
|
const desc = content.find('description');
|
594
|
591
|
let media = '';
|
595
|
|
- const self = this;
|
596
|
592
|
const sctp = content.find(
|
597
|
593
|
'>transport>sctpmap[xmlns="urn:xmpp:jingle:transports:dtls-sctp:1"]');
|
598
|
594
|
|
|
@@ -709,11 +705,11 @@ SDP.prototype.jingle2media = function(content) {
|
709
|
705
|
}
|
710
|
706
|
|
711
|
707
|
// xep-0293
|
712
|
|
- media += self.rtcpFbFromJingle($(payloadType), payloadType.getAttribute('id'));
|
|
708
|
+ media += this.rtcpFbFromJingle($(payloadType), payloadType.getAttribute('id'));
|
713
|
709
|
});
|
714
|
710
|
|
715
|
711
|
// xep-0293
|
716
|
|
- media += self.rtcpFbFromJingle(desc, '*');
|
|
712
|
+ media += this.rtcpFbFromJingle(desc, '*');
|
717
|
713
|
|
718
|
714
|
// xep-0294
|
719
|
715
|
tmp
|
|
@@ -735,11 +731,11 @@ SDP.prototype.jingle2media = function(content) {
|
735
|
731
|
protocol
|
736
|
732
|
= typeof protocol === 'string' ? protocol.toLowerCase() : '';
|
737
|
733
|
|
738
|
|
- if ((self.removeTcpCandidates
|
|
734
|
+ if ((this.removeTcpCandidates
|
739
|
735
|
&& (protocol === 'tcp' || protocol === 'ssltcp'))
|
740
|
|
- || (self.removeUdpCandidates && protocol === 'udp')) {
|
|
736
|
+ || (this.removeUdpCandidates && protocol === 'udp')) {
|
741
|
737
|
return;
|
742
|
|
- } else if (self.failICE) {
|
|
738
|
+ } else if (this.failICE) {
|
743
|
739
|
transport.setAttribute('ip', '1.1.1.1');
|
744
|
740
|
}
|
745
|
741
|
|