浏览代码

ref(JingleSession) Recycle m-lines by rejecting them on source removal.

* ref(JingleSession) Recycle m-lines by rejecting them on source removal.
By rejecting the m-lines on source removal (setting the port to 0 on the associated m-line), m-lines can be recycled for new sources instead of appending new ones.

* chore(deps) update sdp-interop@latest.
release-8443
Jaya Allamsetty 3 年前
父节点
当前提交
989b716597
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 16 次插入11 次删除
  1. 9
    4
      modules/xmpp/JingleSessionPC.js
  2. 6
    6
      package-lock.json
  3. 1
    1
      package.json

+ 9
- 4
modules/xmpp/JingleSessionPC.js 查看文件

1875
                     const mid = remoteSdp.media.findIndex(mLine => mLine.includes(line));
1875
                     const mid = remoteSdp.media.findIndex(mLine => mLine.includes(line));
1876
 
1876
 
1877
                     if (mid > -1) {
1877
                     if (mid > -1) {
1878
+                        const mediaType = SDPUtil.parseMLine(remoteSdp.media[mid].split('\r\n')[0])?.media;
1879
+
1878
                         if (this.isP2P) {
1880
                         if (this.isP2P) {
1879
                             // Do not remove ssrcs from m-line in p2p mode. If the ssrc is removed and added back to
1881
                             // Do not remove ssrcs from m-line in p2p mode. If the ssrc is removed and added back to
1880
                             // the same m-line (on source-add), Chrome/Safari do not render the media even if it is
1882
                             // the same m-line (on source-add), Chrome/Safari do not render the media even if it is
1884
                             // fire the "removetrack" event on the associated MediaStream. Also, the current direction
1886
                             // fire the "removetrack" event on the associated MediaStream. Also, the current direction
1885
                             // of the transceiver for p2p will depend on whether a local sources is added or not. It
1887
                             // of the transceiver for p2p will depend on whether a local sources is added or not. It
1886
                             // will be 'sendrecv' if the local source is present, 'sendonly' otherwise.
1888
                             // will be 'sendrecv' if the local source is present, 'sendonly' otherwise.
1887
-                            const mediaType = SDPUtil.parseMLine(remoteSdp.media[mid].split('\r\n')[0])?.media;
1888
                             const desiredDirection = this.peerconnection.getDesiredMediaDirection(mediaType, false);
1889
                             const desiredDirection = this.peerconnection.getDesiredMediaDirection(mediaType, false);
1889
 
1890
 
1890
                             [ MediaDirection.SENDRECV, MediaDirection.SENDONLY ].forEach(direction => {
1891
                             [ MediaDirection.SENDRECV, MediaDirection.SENDONLY ].forEach(direction => {
1892
                                     .replace(`a=${direction}`, `a=${desiredDirection}`);
1893
                                     .replace(`a=${direction}`, `a=${desiredDirection}`);
1893
                             });
1894
                             });
1894
                         } else {
1895
                         } else {
1895
-                            // Jvb connections will have direction set to 'sendonly' for the remote sources.
1896
+                            // Change the port to 0 to reject the m-line associated with the source. The rejected
1897
+                            // m-lines are recycled when new ssrcs need to be added to the remote description.
1898
+                            const port = SDPUtil.parseMLine(remoteSdp.media[mid].split('\r\n')[0])?.port;
1899
+
1896
                             remoteSdp.media[mid] = remoteSdp.media[mid].replace(`${line}\r\n`, '');
1900
                             remoteSdp.media[mid] = remoteSdp.media[mid].replace(`${line}\r\n`, '');
1897
-                            remoteSdp.media[mid] = remoteSdp.media[mid]
1898
-                                .replace(`a=${MediaDirection.SENDONLY}`, `a=${MediaDirection.INACTIVE}`);
1901
+                            remoteSdp.media[mid] = remoteSdp.media[mid].replace(
1902
+                                `m=${mediaType} ${port}`,
1903
+                                `m=${mediaType} 0`);
1899
                         }
1904
                         }
1900
                     }
1905
                     }
1901
                 });
1906
                 });

+ 6
- 6
package-lock.json 查看文件

12
       "dependencies": {
12
       "dependencies": {
13
         "@jitsi/js-utils": "2.0.0",
13
         "@jitsi/js-utils": "2.0.0",
14
         "@jitsi/logger": "2.0.0",
14
         "@jitsi/logger": "2.0.0",
15
-        "@jitsi/sdp-interop": "github:jitsi/sdp-interop#4669790bb9020cc8f10c1d1f3823c26b08497547",
15
+        "@jitsi/sdp-interop": "github:jitsi/sdp-interop#3707993863eb6c5b6d66c4a025e9dba193775bfb",
16
         "@jitsi/sdp-simulcast": "0.4.0",
16
         "@jitsi/sdp-simulcast": "0.4.0",
17
         "async": "0.9.0",
17
         "async": "0.9.0",
18
         "base64-js": "1.3.1",
18
         "base64-js": "1.3.1",
1855
     },
1855
     },
1856
     "node_modules/@jitsi/sdp-interop": {
1856
     "node_modules/@jitsi/sdp-interop": {
1857
       "version": "1.0.5",
1857
       "version": "1.0.5",
1858
-      "resolved": "git+ssh://git@github.com/jitsi/sdp-interop.git#4669790bb9020cc8f10c1d1f3823c26b08497547",
1859
-      "integrity": "sha512-4nqEqJWyRFjHM/riI0DQRNx+mgx277iK0r5LhwVAHDZDBYbLN54vYcfZ6JepcmygQiixa8jet/gLJnikdH9wzQ==",
1858
+      "resolved": "git+ssh://git@github.com/jitsi/sdp-interop.git#3707993863eb6c5b6d66c4a025e9dba193775bfb",
1859
+      "integrity": "sha512-gqp3Pne45vlrLUyBgfTCw58zMflNripWb2Eaj0mF++U5uk2oRoo1/GBZu2C6Z42ExHfHfhFUFR3N8/Ss2LwnVw==",
1860
       "license": "Apache-2.0",
1860
       "license": "Apache-2.0",
1861
       "dependencies": {
1861
       "dependencies": {
1862
         "lodash.clonedeep": "4.5.0",
1862
         "lodash.clonedeep": "4.5.0",
8393
       "integrity": "sha512-QZE0NpI/GKRdZK0vhuyFYWr4XkCz4slihkSfy6RTszjj/YEHZKIV7yGJo6Hbs3kYI2h5v7apoy+h2WCOMumPJw=="
8393
       "integrity": "sha512-QZE0NpI/GKRdZK0vhuyFYWr4XkCz4slihkSfy6RTszjj/YEHZKIV7yGJo6Hbs3kYI2h5v7apoy+h2WCOMumPJw=="
8394
     },
8394
     },
8395
     "@jitsi/sdp-interop": {
8395
     "@jitsi/sdp-interop": {
8396
-      "version": "git+ssh://git@github.com/jitsi/sdp-interop.git#4669790bb9020cc8f10c1d1f3823c26b08497547",
8397
-      "integrity": "sha512-4nqEqJWyRFjHM/riI0DQRNx+mgx277iK0r5LhwVAHDZDBYbLN54vYcfZ6JepcmygQiixa8jet/gLJnikdH9wzQ==",
8398
-      "from": "@jitsi/sdp-interop@github:jitsi/sdp-interop#4669790bb9020cc8f10c1d1f3823c26b08497547",
8396
+      "version": "git+ssh://git@github.com/jitsi/sdp-interop.git#3707993863eb6c5b6d66c4a025e9dba193775bfb",
8397
+      "integrity": "sha512-gqp3Pne45vlrLUyBgfTCw58zMflNripWb2Eaj0mF++U5uk2oRoo1/GBZu2C6Z42ExHfHfhFUFR3N8/Ss2LwnVw==",
8398
+      "from": "@jitsi/sdp-interop@github:jitsi/sdp-interop#3707993863eb6c5b6d66c4a025e9dba193775bfb",
8399
       "requires": {
8399
       "requires": {
8400
         "lodash.clonedeep": "4.5.0",
8400
         "lodash.clonedeep": "4.5.0",
8401
         "sdp-transform": "2.14.1"
8401
         "sdp-transform": "2.14.1"

+ 1
- 1
package.json 查看文件

18
   "dependencies": {
18
   "dependencies": {
19
     "@jitsi/js-utils": "2.0.0",
19
     "@jitsi/js-utils": "2.0.0",
20
     "@jitsi/logger": "2.0.0",
20
     "@jitsi/logger": "2.0.0",
21
-    "@jitsi/sdp-interop": "github:jitsi/sdp-interop#4669790bb9020cc8f10c1d1f3823c26b08497547",
21
+    "@jitsi/sdp-interop": "github:jitsi/sdp-interop#3707993863eb6c5b6d66c4a025e9dba193775bfb",
22
     "@jitsi/sdp-simulcast": "0.4.0",
22
     "@jitsi/sdp-simulcast": "0.4.0",
23
     "async": "0.9.0",
23
     "async": "0.9.0",
24
     "base64-js": "1.3.1",
24
     "base64-js": "1.3.1",

正在加载...
取消
保存