|
@@ -525,15 +525,12 @@ SDP.prototype.rtcpFbFromJingle = function(elem, payloadtype) { // XEP-0293
|
525
|
525
|
media += '\r\n';
|
526
|
526
|
}
|
527
|
527
|
tmp = elem.find('>rtcp-fb[xmlns="urn:xmpp:jingle:apps:rtp:rtcp-fb:0"]');
|
528
|
|
- tmp.each(function() {
|
529
|
|
- /* eslint-disable no-invalid-this */
|
530
|
|
- media += `a=rtcp-fb:${payloadtype} ${$(this).attr('type')}`;
|
531
|
|
- if ($(this).attr('subtype')) {
|
532
|
|
- media += ` ${$(this).attr('subtype')}`;
|
|
528
|
+ tmp.each((_, fb) => {
|
|
529
|
+ media += `a=rtcp-fb:${payloadtype} ${fb.getAttribute('type')}`;
|
|
530
|
+ if (fb.hasAttribute('subtype')) {
|
|
531
|
+ media += ` ${fb.getAttribute('subtype')}`;
|
533
|
532
|
}
|
534
|
533
|
media += '\r\n';
|
535
|
|
-
|
536
|
|
- /* eslint-enable no-invalid-this */
|
537
|
534
|
});
|
538
|
535
|
|
539
|
536
|
return media;
|
|
@@ -574,9 +571,8 @@ SDP.prototype.fromJingle = function(jingle) {
|
574
|
571
|
}
|
575
|
572
|
|
576
|
573
|
this.session = this.raw;
|
577
|
|
- jingle.find('>content').each(function() {
|
578
|
|
- // eslint-disable-next-line no-invalid-this
|
579
|
|
- const m = self.jingle2media($(this));
|
|
574
|
+ jingle.find('>content').each((_, content) => {
|
|
575
|
+ const m = self.jingle2media($(content));
|
580
|
576
|
|
581
|
577
|
self.media.push(m);
|
582
|
578
|
});
|
|
@@ -629,10 +625,7 @@ SDP.prototype.jingle2media = function(content) {
|
629
|
625
|
tmp.fmt
|
630
|
626
|
= desc
|
631
|
627
|
.find('payload-type')
|
632
|
|
- .map(function() {
|
633
|
|
- // eslint-disable-next-line no-invalid-this
|
634
|
|
- return this.getAttribute('id');
|
635
|
|
- })
|
|
628
|
+ .map((_, payloadType) => payloadType.getAttribute('id'))
|
636
|
629
|
.get();
|
637
|
630
|
media += `${SDPUtil.buildMLine(tmp)}\r\n`;
|
638
|
631
|
}
|
|
@@ -651,17 +644,14 @@ SDP.prototype.jingle2media = function(content) {
|
651
|
644
|
if (tmp.attr('pwd')) {
|
652
|
645
|
media += `${SDPUtil.buildICEPwd(tmp.attr('pwd'))}\r\n`;
|
653
|
646
|
}
|
654
|
|
- tmp.find('>fingerprint').each(function() {
|
655
|
|
- /* eslint-disable no-invalid-this */
|
|
647
|
+ tmp.find('>fingerprint').each((_, fingerprint) => {
|
656
|
648
|
// FIXME: check namespace at some point
|
657
|
|
- media += `a=fingerprint:${this.getAttribute('hash')}`;
|
658
|
|
- media += ` ${$(this).text()}`;
|
|
649
|
+ media += `a=fingerprint:${fingerprint.getAttribute('hash')}`;
|
|
650
|
+ media += ` ${$(fingerprint).text()}`;
|
659
|
651
|
media += '\r\n';
|
660
|
|
- if (this.getAttribute('setup')) {
|
661
|
|
- media += `a=setup:${this.getAttribute('setup')}\r\n`;
|
|
652
|
+ if (fingerprint.hasAttribute('setup')) {
|
|
653
|
+ media += `a=setup:${fingerprint.getAttribute('setup')}\r\n`;
|
662
|
654
|
}
|
663
|
|
-
|
664
|
|
- /* eslint-enable no-invalid-this */
|
665
|
655
|
});
|
666
|
656
|
}
|
667
|
657
|
switch (content.attr('senders')) {
|
|
@@ -689,33 +679,30 @@ SDP.prototype.jingle2media = function(content) {
|
689
|
679
|
}
|
690
|
680
|
|
691
|
681
|
if (desc.find('encryption').length) {
|
692
|
|
- desc.find('encryption>crypto').each(function() {
|
693
|
|
- /* eslint-disable no-invalid-this */
|
694
|
|
- media += `a=crypto:${this.getAttribute('tag')}`;
|
695
|
|
- media += ` ${this.getAttribute('crypto-suite')}`;
|
696
|
|
- media += ` ${this.getAttribute('key-params')}`;
|
697
|
|
- if (this.getAttribute('session-params')) {
|
698
|
|
- media += ` ${this.getAttribute('session-params')}`;
|
|
682
|
+ desc.find('encryption>crypto').each((_, crypto) => {
|
|
683
|
+ media += `a=crypto:${crypto.getAttribute('tag')}`;
|
|
684
|
+ media += ` ${crypto.getAttribute('crypto-suite')}`;
|
|
685
|
+ media += ` ${crypto.getAttribute('key-params')}`;
|
|
686
|
+ if (crypto.hasAttribute('session-params')) {
|
|
687
|
+ media += ` ${crypto.getAttribute('session-params')}`;
|
699
|
688
|
}
|
700
|
689
|
media += '\r\n';
|
701
|
|
-
|
702
|
|
- /* eslint-enable no-invalid-this */
|
703
|
690
|
});
|
704
|
691
|
}
|
705
|
|
- desc.find('payload-type').each(function() {
|
706
|
|
- /* eslint-disable no-invalid-this */
|
707
|
|
- media += `${SDPUtil.buildRTPMap(this)}\r\n`;
|
708
|
|
- if ($(this).find('>parameter').length) {
|
709
|
|
- media += `a=fmtp:${this.getAttribute('id')} `;
|
|
692
|
+
|
|
693
|
+ desc.find('payload-type').each((_, payloadType) => {
|
|
694
|
+ media += `${SDPUtil.buildRTPMap(payloadType)}\r\n`;
|
|
695
|
+ if ($(payloadType).find('>parameter').length) {
|
|
696
|
+ media += `a=fmtp:${payloadType.getAttribute('id')} `;
|
710
|
697
|
media
|
711
|
|
- += $(this)
|
|
698
|
+ += $(payloadType)
|
712
|
699
|
.find('parameter')
|
713
|
|
- .map(function() {
|
714
|
|
- const name = this.getAttribute('name');
|
|
700
|
+ .map((__, parameter) => {
|
|
701
|
+ const name = parameter.getAttribute('name');
|
715
|
702
|
|
716
|
703
|
return (
|
717
|
704
|
(name ? `${name}=` : '')
|
718
|
|
- + this.getAttribute('value'));
|
|
705
|
+ + parameter.getAttribute('value'));
|
719
|
706
|
})
|
720
|
707
|
.get()
|
721
|
708
|
.join('; ');
|
|
@@ -723,9 +710,7 @@ SDP.prototype.jingle2media = function(content) {
|
723
|
710
|
}
|
724
|
711
|
|
725
|
712
|
// xep-0293
|
726
|
|
- media += self.rtcpFbFromJingle($(this), this.getAttribute('id'));
|
727
|
|
-
|
728
|
|
- /* eslint-enable no-invalid-this */
|
|
713
|
+ media += self.rtcpFbFromJingle($(payloadType), payloadType.getAttribute('id'));
|
729
|
714
|
});
|
730
|
715
|
|
731
|
716
|
// xep-0293
|
|
@@ -735,22 +720,18 @@ SDP.prototype.jingle2media = function(content) {
|
735
|
720
|
tmp
|
736
|
721
|
= desc.find(
|
737
|
722
|
'>rtp-hdrext[xmlns="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0"]');
|
738
|
|
- tmp.each(function() {
|
739
|
|
- /* eslint-disable no-invalid-this */
|
|
723
|
+ tmp.each((_, hdrExt) => {
|
740
|
724
|
media
|
741
|
|
- += `a=extmap:${this.getAttribute('id')} ${
|
742
|
|
- this.getAttribute('uri')}\r\n`;
|
743
|
|
-
|
744
|
|
- /* eslint-enable no-invalid-this */
|
|
725
|
+ += `a=extmap:${hdrExt.getAttribute('id')} ${
|
|
726
|
+ hdrExt.getAttribute('uri')}\r\n`;
|
745
|
727
|
});
|
746
|
728
|
|
747
|
729
|
content
|
748
|
730
|
.find(
|
749
|
731
|
'>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]'
|
750
|
732
|
+ '>candidate')
|
751
|
|
- .each(function() {
|
752
|
|
- /* eslint-disable no-invalid-this */
|
753
|
|
- let protocol = this.getAttribute('protocol');
|
|
733
|
+ .each((_, transport) => {
|
|
734
|
+ let protocol = transport.getAttribute('protocol');
|
754
|
735
|
|
755
|
736
|
protocol
|
756
|
737
|
= typeof protocol === 'string' ? protocol.toLowerCase() : '';
|
|
@@ -760,56 +741,47 @@ SDP.prototype.jingle2media = function(content) {
|
760
|
741
|
|| (self.removeUdpCandidates && protocol === 'udp')) {
|
761
|
742
|
return;
|
762
|
743
|
} else if (self.failICE) {
|
763
|
|
- this.setAttribute('ip', '1.1.1.1');
|
|
744
|
+ transport.setAttribute('ip', '1.1.1.1');
|
764
|
745
|
}
|
765
|
746
|
|
766
|
|
- media += SDPUtil.candidateFromJingle(this);
|
767
|
|
-
|
768
|
|
- /* eslint-enable no-invalid-this */
|
|
747
|
+ media += SDPUtil.candidateFromJingle(transport);
|
769
|
748
|
});
|
770
|
749
|
|
771
|
750
|
// XEP-0339 handle ssrc-group attributes
|
772
|
751
|
content
|
773
|
752
|
.find('description>ssrc-group[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]')
|
774
|
|
- .each(function() {
|
775
|
|
- /* eslint-disable no-invalid-this */
|
776
|
|
- const semantics = this.getAttribute('semantics');
|
|
753
|
+ .each((_, ssrcGroup) => {
|
|
754
|
+ const semantics = ssrcGroup.getAttribute('semantics');
|
777
|
755
|
const ssrcs
|
778
|
|
- = $(this)
|
|
756
|
+ = $(ssrcGroup)
|
779
|
757
|
.find('>source')
|
780
|
|
- .map(function() {
|
781
|
|
- return this.getAttribute('ssrc');
|
782
|
|
- })
|
|
758
|
+ .map((__, source) => source.getAttribute('ssrc'))
|
783
|
759
|
.get();
|
784
|
760
|
|
785
|
761
|
if (ssrcs.length) {
|
786
|
762
|
media += `a=ssrc-group:${semantics} ${ssrcs.join(' ')}\r\n`;
|
787
|
763
|
}
|
788
|
|
-
|
789
|
|
- /* eslint-enable no-invalid-this */
|
790
|
764
|
});
|
791
|
765
|
|
792
|
766
|
tmp
|
793
|
767
|
= content.find(
|
794
|
768
|
'description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
|
795
|
|
- tmp.each(function() {
|
796
|
|
- /* eslint-disable no-invalid-this */
|
797
|
|
- const ssrc = this.getAttribute('ssrc');
|
798
|
|
-
|
799
|
|
- // eslint-disable-next-line newline-per-chained-call
|
800
|
|
- $(this).find('>parameter').each(function() {
|
801
|
|
- const name = this.getAttribute('name');
|
802
|
|
- let value = this.getAttribute('value');
|
803
|
|
-
|
804
|
|
- value = SDPUtil.filterSpecialChars(value);
|
805
|
|
- media += `a=ssrc:${ssrc} ${name}`;
|
806
|
|
- if (value && value.length) {
|
807
|
|
- media += `:${value}`;
|
808
|
|
- }
|
809
|
|
- media += '\r\n';
|
810
|
|
- });
|
811
|
|
-
|
812
|
|
- /* eslint-enable no-invalid-this */
|
|
769
|
+ tmp.each((_, source) => {
|
|
770
|
+ const ssrc = source.getAttribute('ssrc');
|
|
771
|
+
|
|
772
|
+ $(source)
|
|
773
|
+ .find('>parameter')
|
|
774
|
+ .each((__, parameter) => {
|
|
775
|
+ const name = parameter.getAttribute('name');
|
|
776
|
+ let value = parameter.getAttribute('value');
|
|
777
|
+
|
|
778
|
+ value = SDPUtil.filterSpecialChars(value);
|
|
779
|
+ media += `a=ssrc:${ssrc} ${name}`;
|
|
780
|
+ if (value && value.length) {
|
|
781
|
+ media += `:${value}`;
|
|
782
|
+ }
|
|
783
|
+ media += '\r\n';
|
|
784
|
+ });
|
813
|
785
|
});
|
814
|
786
|
|
815
|
787
|
return media;
|