瀏覽代碼

ref(video-quality): handle promise returned by video quality methods

dev1
Jaya Allamsetty 5 年之前
父節點
當前提交
353e5715e2
共有 1 個檔案被更改,包括 12 行新增6 行删除
  1. 12
    6
      modules/xmpp/JingleSessionPC.js

+ 12
- 6
modules/xmpp/JingleSessionPC.js 查看文件

@@ -1381,12 +1381,15 @@ export default class JingleSessionPC extends JingleSession {
1381 1381
      * Sets the maximum bitrates on the local video track if the current
1382 1382
      * session is a JVB session. Bitrate values from videoQuality settings
1383 1383
      * in config.js will be used for configuring the sender.
1384
-     * @returns {void}
1384
+     * @returns {Promise<void>} promise that will be resolved when the operation is
1385
+     * successful and rejected otherwise.
1385 1386
      */
1386 1387
     setSenderMaxBitrates() {
1387 1388
         if (this._assertNotEnded() && !this.isP2P) {
1388 1389
             return this.peerconnection.setMaxBitRate();
1389 1390
         }
1391
+
1392
+        return Promise.resolve();
1390 1393
     }
1391 1394
 
1392 1395
     /**
@@ -1408,12 +1411,15 @@ export default class JingleSessionPC extends JingleSession {
1408 1411
     /**
1409 1412
      * Sets the degradation preference on the video sender. This setting determines if
1410 1413
      * resolution or framerate will be preferred when bandwidth or cpu is constrained.
1411
-     * @returns {void}
1414
+     * @returns {Promise<void>} promise that will be resolved when the operation is
1415
+     * successful and rejected otherwise.
1412 1416
      */
1413 1417
     setSenderVideoDegradationPreference() {
1414 1418
         if (this._assertNotEnded()) {
1415
-            this.peerconnection.setSenderVideoDegradationPreference();
1419
+            return this.peerconnection.setSenderVideoDegradationPreference();
1416 1420
         }
1421
+
1422
+        return Promise.resolve();
1417 1423
     }
1418 1424
 
1419 1425
     /**
@@ -2067,9 +2073,9 @@ export default class JingleSessionPC extends JingleSession {
2067 2073
                 // Apply the video constraints, max bitrates and degradation preference on
2068 2074
                 // the video sender if needed.
2069 2075
                 if (track.isVideoTrack() && browser.doesVideoMuteByStreamRemove()) {
2070
-                    this.setSenderMaxBitrates();
2071
-                    this.setSenderVideoDegradationPreference();
2072
-                    this.setSenderVideoConstraint();
2076
+                    return this.setSenderMaxBitrates()
2077
+                        .then(() => this.setSenderVideoDegradationPreference())
2078
+                        .then(() => this.setSenderVideoConstraint());
2073 2079
                 }
2074 2080
             });
2075 2081
     }

Loading…
取消
儲存