소스 검색

ref(SDP) Convert to ES6 class. (#2572)

* ref(SDP) Convert to ES6 class.

* ref(SDP) Use enum for URNs associated with XMPP extensions.

* ref(XMPP) Replace more XEP URN constants with enum.

* fix(RTC) Fixes mediaType lookup based on source-name.
release-8443
Jaya Allamsetty 1 년 전
부모
커밋
ef92c2a044
No account linked to committer's email address
7개의 변경된 파일715개의 추가작업 그리고 699개의 파일을 삭제
  1. 606
    675
      modules/sdp/SDP.js
  2. 8
    5
      modules/sdp/SDPDiffer.js
  3. 5
    4
      modules/xmpp/JingleHelperFunctions.js
  4. 8
    7
      modules/xmpp/JingleSessionPC.js
  5. 8
    7
      modules/xmpp/xmpp.js
  6. 6
    1
      service/RTC/MediaType.ts
  7. 74
    0
      service/xmpp/XMPPExtensioProtocols.ts

+ 606
- 675
modules/sdp/SDP.js
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 8
- 5
modules/sdp/SDPDiffer.js 파일 보기

1
 
1
 
2
+import { XEP } from '../../service/xmpp/XMPPExtensioProtocols';
3
+
2
 import SDPUtil from './SDPUtil';
4
 import SDPUtil from './SDPUtil';
3
 
5
 
4
 // this could be useful in Array.prototype.
6
 // this could be useful in Array.prototype.
159
 
161
 
160
         modify.c('content', { name: media.mid });
162
         modify.c('content', { name: media.mid });
161
 
163
 
162
-        modify.c('description',
163
-            { xmlns: 'urn:xmpp:jingle:apps:rtp:1',
164
-                media: media.mid });
164
+        modify.c('description', {
165
+            xmlns: XEP.RTP_MEDIA,
166
+            media: media.mid
167
+        });
165
 
168
 
166
         // FIXME: not completely sure this operates on blocks and / or handles
169
         // FIXME: not completely sure this operates on blocks and / or handles
167
         // different ssrcs correctly
170
         // different ssrcs correctly
172
             const sourceName = SDPUtil.parseSourceNameLine(ssrcLines);
175
             const sourceName = SDPUtil.parseSourceNameLine(ssrcLines);
173
             const videoType = SDPUtil.parseVideoTypeLine(ssrcLines);
176
             const videoType = SDPUtil.parseVideoTypeLine(ssrcLines);
174
 
177
 
175
-            modify.c('source', { xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
178
+            modify.c('source', { xmlns: XEP.SOURCE_ATTRIBUTES });
176
             modify.attrs({
179
             modify.attrs({
177
                 name: sourceName,
180
                 name: sourceName,
178
                 videoType,
181
                 videoType,
198
 
201
 
199
                 modify.c('ssrc-group', {
202
                 modify.c('ssrc-group', {
200
                     semantics: ssrcGroup.semantics,
203
                     semantics: ssrcGroup.semantics,
201
-                    xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0'
204
+                    xmlns: XEP.SOURCE_ATTRIBUTES
202
                 });
205
                 });
203
 
206
 
204
                 ssrcGroup.ssrcs.forEach(ssrc => {
207
                 ssrcGroup.ssrcs.forEach(ssrc => {

+ 5
- 4
modules/xmpp/JingleHelperFunctions.js 파일 보기

4
 import { $build } from 'strophe.js';
4
 import { $build } from 'strophe.js';
5
 
5
 
6
 import { MediaType } from '../../service/RTC/MediaType';
6
 import { MediaType } from '../../service/RTC/MediaType';
7
+import { XEP } from '../../service/xmpp/XMPPExtensioProtocols';
7
 
8
 
8
 const logger = getLogger(__filename);
9
 const logger = getLogger(__filename);
9
 
10
 
15
  */
16
  */
16
 function _createSourceExtension(owner, sourceCompactJson) {
17
 function _createSourceExtension(owner, sourceCompactJson) {
17
     const node = $build('source', {
18
     const node = $build('source', {
18
-        xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0',
19
+        xmlns: XEP.SOURCE_ATTRIBUTES,
19
         ssrc: sourceCompactJson.s,
20
         ssrc: sourceCompactJson.s,
20
         name: sourceCompactJson.n
21
         name: sourceCompactJson.n
21
     });
22
     });
41
  */
42
  */
42
 function _createSsrcGroupExtension(ssrcGroupCompactJson) {
43
 function _createSsrcGroupExtension(ssrcGroupCompactJson) {
43
     const node = $build('ssrc-group', {
44
     const node = $build('ssrc-group', {
44
-        xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0',
45
+        xmlns: XEP.SOURCE_ATTRIBUTES,
45
         semantics: _getSemantics(ssrcGroupCompactJson[0])
46
         semantics: _getSemantics(ssrcGroupCompactJson[0])
46
     });
47
     });
47
 
48
 
48
     for (let i = 1; i < ssrcGroupCompactJson.length; i++) {
49
     for (let i = 1; i < ssrcGroupCompactJson.length; i++) {
49
         node.c('source', {
50
         node.c('source', {
50
-            xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0',
51
+            xmlns: XEP.SOURCE_ATTRIBUTES,
51
             ssrc: ssrcGroupCompactJson[i]
52
             ssrc: ssrcGroupCompactJson[i]
52
         }).up();
53
         }).up();
53
     }
54
     }
83
         description = description[0];
84
         description = description[0];
84
     } else {
85
     } else {
85
         description = $build('description', {
86
         description = $build('description', {
86
-            xmlns: 'urn:xmpp:jingle:apps:rtp:1',
87
+            xmlns: XEP.RTP_MEDIA,
87
             media: mediaType
88
             media: mediaType
88
         }).node;
89
         }).node;
89
         content.appendChild(description);
90
         content.appendChild(description);

+ 8
- 7
modules/xmpp/JingleSessionPC.js 파일 보기

13
     VIDEO_CODEC_CHANGED
13
     VIDEO_CODEC_CHANGED
14
 } from '../../service/statistics/AnalyticsEvents';
14
 } from '../../service/statistics/AnalyticsEvents';
15
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
15
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
16
+import { XEP } from '../../service/xmpp/XMPPExtensioProtocols';
16
 import { SS_DEFAULT_FRAME_RATE } from '../RTC/ScreenObtainer';
17
 import { SS_DEFAULT_FRAME_RATE } from '../RTC/ScreenObtainer';
17
 import FeatureFlags from '../flags/FeatureFlags';
18
 import FeatureFlags from '../flags/FeatureFlags';
18
 import SDP from '../sdp/SDP';
19
 import SDP from '../sdp/SDP';
68
 function _addSourceElement(description, s, ssrc_, msid) {
69
 function _addSourceElement(description, s, ssrc_, msid) {
69
 
70
 
70
     description.c('source', {
71
     description.c('source', {
71
-        xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0',
72
+        xmlns: XEP.SOURCE_ATTRIBUTES,
72
         ssrc: ssrc_,
73
         ssrc: ssrc_,
73
         name: s.source
74
         name: s.source
74
     })
75
     })
713
 
714
 
714
                 return;
715
                 return;
715
             }
716
             }
716
-            ice.xmlns = 'urn:xmpp:jingle:transports:ice-udp:1';
717
+            ice.xmlns = XEP.ICE_UDP_TRANSPORT;
717
 
718
 
718
             if (this.usedrip) {
719
             if (this.usedrip) {
719
                 if (this.dripContainer.length === 0) {
720
                 if (this.dripContainer.length === 0) {
768
                 const ice
769
                 const ice
769
                     = SDPUtil.iceparams(localSDP.media[mid], localSDP.session);
770
                     = SDPUtil.iceparams(localSDP.media[mid], localSDP.session);
770
 
771
 
771
-                ice.xmlns = 'urn:xmpp:jingle:transports:ice-udp:1';
772
+                ice.xmlns = XEP.ICE_UDP_TRANSPORT;
772
                 cand.c('content', {
773
                 cand.c('content', {
773
                     creator: this.initiatorJid === this.localJid
774
                     creator: this.initiatorJid === this.localJid
774
                         ? 'initiator' : 'responder',
775
                         ? 'initiator' : 'responder',
1834
                 xmlns: 'urn:xmpp:jingle:1',
1835
                 xmlns: 'urn:xmpp:jingle:1',
1835
                 name: mediaType
1836
                 name: mediaType
1836
             }).c('description', {
1837
             }).c('description', {
1837
-                xmlns: 'urn:xmpp:jingle:apps:rtp:1',
1838
+                xmlns: XEP.RTP_MEDIA,
1838
                 media: mediaType
1839
                 media: mediaType
1839
             });
1840
             });
1840
 
1841
 
1850
                     if (rtx !== '-1') {
1851
                     if (rtx !== '-1') {
1851
                         _addSourceElement(node, src, rtx, msid);
1852
                         _addSourceElement(node, src, rtx, msid);
1852
                         node.c('ssrc-group', {
1853
                         node.c('ssrc-group', {
1853
-                            xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0',
1854
+                            xmlns: XEP.SOURCE_ATTRIBUTES,
1854
                             semantics: 'FID'
1855
                             semantics: 'FID'
1855
                         })
1856
                         })
1856
                             .c('source', {
1857
                             .c('source', {
1857
-                                xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0',
1858
+                                xmlns: XEP.SOURCE_ATTRIBUTES,
1858
                                 ssrc
1859
                                 ssrc
1859
                             })
1860
                             })
1860
                             .up()
1861
                             .up()
1861
                             .c('source', {
1862
                             .c('source', {
1862
-                                xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0',
1863
+                                xmlns: XEP.SOURCE_ATTRIBUTES,
1863
                                 ssrc: rtx
1864
                                 ssrc: rtx
1864
                             })
1865
                             })
1865
                             .up()
1866
                             .up()

+ 8
- 7
modules/xmpp/xmpp.js 파일 보기

7
 import * as JitsiConnectionErrors from '../../JitsiConnectionErrors';
7
 import * as JitsiConnectionErrors from '../../JitsiConnectionErrors';
8
 import * as JitsiConnectionEvents from '../../JitsiConnectionEvents';
8
 import * as JitsiConnectionEvents from '../../JitsiConnectionEvents';
9
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
9
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
10
+import { XEP } from '../../service/xmpp/XMPPExtensioProtocols';
10
 import browser from '../browser';
11
 import browser from '../browser';
11
 import { E2EEncryption } from '../e2ee/E2EEncryption';
12
 import { E2EEncryption } from '../e2ee/E2EEncryption';
12
 import FeatureFlags from '../flags/FeatureFlags';
13
 import FeatureFlags from '../flags/FeatureFlags';
218
     initFeaturesList() {
219
     initFeaturesList() {
219
         // http://xmpp.org/extensions/xep-0167.html#support
220
         // http://xmpp.org/extensions/xep-0167.html#support
220
         // http://xmpp.org/extensions/xep-0176.html#support
221
         // http://xmpp.org/extensions/xep-0176.html#support
221
-        this.caps.addFeature('urn:xmpp:jingle:1');
222
-        this.caps.addFeature('urn:xmpp:jingle:apps:rtp:1');
223
-        this.caps.addFeature('urn:xmpp:jingle:transports:ice-udp:1');
224
-        this.caps.addFeature('urn:xmpp:jingle:apps:dtls:0');
225
-        this.caps.addFeature('urn:xmpp:jingle:transports:dtls-sctp:1');
226
-        this.caps.addFeature('urn:xmpp:jingle:apps:rtp:audio');
227
-        this.caps.addFeature('urn:xmpp:jingle:apps:rtp:video');
222
+        this.caps.addFeature(XEP.JINGLE);
223
+        this.caps.addFeature(XEP.RTP_MEDIA);
224
+        this.caps.addFeature(XEP.ICE_UDP_TRANSPORT);
225
+        this.caps.addFeature(XEP.DTLS_SRTP);
226
+        this.caps.addFeature(XEP.SCTP_DATA_CHANNEL);
227
+        this.caps.addFeature(XEP.RTP_AUDIO);
228
+        this.caps.addFeature(XEP.RTP_VIDEO);
228
         this.caps.addFeature('http://jitsi.org/json-encoded-sources');
229
         this.caps.addFeature('http://jitsi.org/json-encoded-sources');
229
 
230
 
230
         if (!(this.options.disableRtx || !browser.supportsRTX())) {
231
         if (!(this.options.disableRtx || !browser.supportsRTX())) {

+ 6
- 1
service/RTC/MediaType.ts 파일 보기

7
     /**
7
     /**
8
      * The video type.
8
      * The video type.
9
      */
9
      */
10
-    VIDEO = 'video'
10
+    VIDEO = 'video',
11
+
12
+    /**
13
+     * The application type (data over bridge channel).
14
+     */
15
+    APPLICATION = 'application'
11
 }
16
 }

+ 74
- 0
service/xmpp/XMPPExtensioProtocols.ts 파일 보기

1
+
2
+export enum XEP {
3
+    /**
4
+     * XEP-0338 - Signals the usage of bundled media, i.e., allows the use of a single set of ICE candidates for
5
+     * multiple media descriptions.
6
+     * https://xmpp.org/extensions/attic/xep-0338-1.0.0.html
7
+     */
8
+    BUNDLE_MEDIA = 'urn:xmpp:jingle:apps:grouping:0',
9
+
10
+    /**
11
+     * XEP-0320 - Signals the use of DTLS-SRTP in Jingle session.
12
+     * https://xmpp.org/extensions/xep-0320.html
13
+     */
14
+    DTLS_SRTP = 'urn:xmpp:jingle:apps:dtls:0',
15
+
16
+    /**
17
+     * XEP-0176 - Signaling ICE-UDP transport method.
18
+     * https://xmpp.org/extensions/xep-0176.html
19
+     */
20
+    ICE_UDP_TRANSPORT = 'urn:xmpp:jingle:transports:ice-udp:1',
21
+
22
+    /**
23
+     * XEP-0166 - Jingle.
24
+     * https://xmpp.org/extensions/xep-0166.html
25
+     */
26
+    JINGLE = 'urn:xmpp:jingle:1',
27
+
28
+    /**
29
+     * XEP-0327 - Rayo for allowing third-party control over media sessions.
30
+     */
31
+    RAYO = 'urn:xmpp:rayo:client:1',
32
+
33
+    /**
34
+     * XEP-0167 - Signals support for RTP audio.
35
+     * https://xmpp.org/extensions/xep-0167.html#support
36
+     */
37
+    RTP_AUDIO = 'urn:xmpp:jingle:apps:rtp:audio',
38
+
39
+    /**
40
+     * XEP-0293 - Signals the use of RTP Feedback Negotiation.
41
+     * https://xmpp.org/extensions/xep-0293.html
42
+     */
43
+    RTP_FEEDBACK = 'urn:xmpp:jingle:apps:rtp:rtcp-fb:0',
44
+
45
+    /**
46
+     * XEP-0167 - Signals support for RTP video.
47
+     * https://xmpp.org/extensions/xep-0167.html#support
48
+     */
49
+    RTP_VIDEO = 'urn:xmpp:jingle:apps:rtp:video',
50
+
51
+    /**
52
+     * XEP-0294 - Signals the use of RTP Header Extensions.
53
+     * https://xmpp.org/extensions/xep-0294.html
54
+     */
55
+    RTP_HEADER_EXTENSIONS = 'urn:xmpp:jingle:apps:rtp:rtp-hdrext:0',
56
+
57
+    /**
58
+     * XEP-0167 - Signals parameters necessary for media sessions using RTP.
59
+     * https://xmpp.org/extensions/xep-0167.html
60
+     */
61
+    RTP_MEDIA = 'urn:xmpp:jingle:apps:rtp:1',
62
+
63
+    /**
64
+     * XEP-0343 - Signaling WebRTC datachannels (bridge channel) in Jingle that uses DTLS/SCTP on top of ICE.
65
+     * https://xmpp.org/extensions/xep-0343.html
66
+     */
67
+    SCTP_DATA_CHANNEL = 'urn:xmpp:jingle:transports:dtls-sctp:1',
68
+
69
+    /**
70
+     * XEP-0339 - Signals Source-Specific Media Attributes in Jingle.
71
+     * https://xmpp.org/extensions/xep-0339.html
72
+     */
73
+    SOURCE_ATTRIBUTES = 'urn:xmpp:jingle:apps:rtp:ssma:0'
74
+}

Loading…
취소
저장