浏览代码

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
      * Sets the maximum bitrates on the local video track if the current
1381
      * Sets the maximum bitrates on the local video track if the current
1382
      * session is a JVB session. Bitrate values from videoQuality settings
1382
      * session is a JVB session. Bitrate values from videoQuality settings
1383
      * in config.js will be used for configuring the sender.
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
     setSenderMaxBitrates() {
1387
     setSenderMaxBitrates() {
1387
         if (this._assertNotEnded() && !this.isP2P) {
1388
         if (this._assertNotEnded() && !this.isP2P) {
1388
             return this.peerconnection.setMaxBitRate();
1389
             return this.peerconnection.setMaxBitRate();
1389
         }
1390
         }
1391
+
1392
+        return Promise.resolve();
1390
     }
1393
     }
1391
 
1394
 
1392
     /**
1395
     /**
1408
     /**
1411
     /**
1409
      * Sets the degradation preference on the video sender. This setting determines if
1412
      * Sets the degradation preference on the video sender. This setting determines if
1410
      * resolution or framerate will be preferred when bandwidth or cpu is constrained.
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
     setSenderVideoDegradationPreference() {
1417
     setSenderVideoDegradationPreference() {
1414
         if (this._assertNotEnded()) {
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
                 // Apply the video constraints, max bitrates and degradation preference on
2073
                 // Apply the video constraints, max bitrates and degradation preference on
2068
                 // the video sender if needed.
2074
                 // the video sender if needed.
2069
                 if (track.isVideoTrack() && browser.doesVideoMuteByStreamRemove()) {
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
     }

正在加载...
取消
保存