瀏覽代碼

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.
dev1
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,6 +1875,8 @@ export default class JingleSessionPC extends JingleSession {
1875 1875
                     const mid = remoteSdp.media.findIndex(mLine => mLine.includes(line));
1876 1876
 
1877 1877
                     if (mid > -1) {
1878
+                        const mediaType = SDPUtil.parseMLine(remoteSdp.media[mid].split('\r\n')[0])?.media;
1879
+
1878 1880
                         if (this.isP2P) {
1879 1881
                             // Do not remove ssrcs from m-line in p2p mode. If the ssrc is removed and added back to
1880 1882
                             // the same m-line (on source-add), Chrome/Safari do not render the media even if it is
@@ -1884,7 +1886,6 @@ export default class JingleSessionPC extends JingleSession {
1884 1886
                             // fire the "removetrack" event on the associated MediaStream. Also, the current direction
1885 1887
                             // of the transceiver for p2p will depend on whether a local sources is added or not. It
1886 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 1889
                             const desiredDirection = this.peerconnection.getDesiredMediaDirection(mediaType, false);
1889 1890
 
1890 1891
                             [ MediaDirection.SENDRECV, MediaDirection.SENDONLY ].forEach(direction => {
@@ -1892,10 +1893,14 @@ export default class JingleSessionPC extends JingleSession {
1892 1893
                                     .replace(`a=${direction}`, `a=${desiredDirection}`);
1893 1894
                             });
1894 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 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,7 +12,7 @@
12 12
       "dependencies": {
13 13
         "@jitsi/js-utils": "2.0.0",
14 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 16
         "@jitsi/sdp-simulcast": "0.4.0",
17 17
         "async": "0.9.0",
18 18
         "base64-js": "1.3.1",
@@ -1855,8 +1855,8 @@
1855 1855
     },
1856 1856
     "node_modules/@jitsi/sdp-interop": {
1857 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 1860
       "license": "Apache-2.0",
1861 1861
       "dependencies": {
1862 1862
         "lodash.clonedeep": "4.5.0",
@@ -8393,9 +8393,9 @@
8393 8393
       "integrity": "sha512-QZE0NpI/GKRdZK0vhuyFYWr4XkCz4slihkSfy6RTszjj/YEHZKIV7yGJo6Hbs3kYI2h5v7apoy+h2WCOMumPJw=="
8394 8394
     },
8395 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 8399
       "requires": {
8400 8400
         "lodash.clonedeep": "4.5.0",
8401 8401
         "sdp-transform": "2.14.1"

+ 1
- 1
package.json 查看文件

@@ -18,7 +18,7 @@
18 18
   "dependencies": {
19 19
     "@jitsi/js-utils": "2.0.0",
20 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 22
     "@jitsi/sdp-simulcast": "0.4.0",
23 23
     "async": "0.9.0",
24 24
     "base64-js": "1.3.1",

Loading…
取消
儲存