瀏覽代碼

cleanup: use feature detection for RTX

dev1
Saúl Ibarra Corretgé 8 年之前
父節點
當前提交
3ad8d182a2
共有 3 個文件被更改,包括 7 次插入3 次删除
  1. 4
    0
      modules/RTC/RTCBrowserType.js
  2. 2
    2
      modules/RTC/TraceablePeerConnection.js
  3. 1
    1
      modules/xmpp/xmpp.js

+ 4
- 0
modules/RTC/RTCBrowserType.js 查看文件

@@ -179,6 +179,10 @@ const RTCBrowserType = {
179 179
         // whether to actually enable simulcast or not).
180 180
         // TODO: the logic should be in one single place.
181 181
         return window.chrome !== undefined;
182
+    },
183
+
184
+    supportsRtx() {
185
+        return !RTCBrowserType.isFirefox();
182 186
     }
183 187
 
184 188
     // Add version getters for other browsers when needed

+ 2
- 2
modules/RTC/TraceablePeerConnection.js 查看文件

@@ -930,7 +930,7 @@ TraceablePeerConnection.prototype.createAnswer
930 930
                         dumpSDP(answer));
931 931
                 }
932 932
 
933
-                if (!this.options.disableRtx && !RTCBrowserType.isFirefox()) {
933
+                if (!this.options.disableRtx && RTCBrowserType.supportsRtx()) {
934 934
                     answer.sdp = this.rtxModifier.modifyRtxSsrcs(answer.sdp);
935 935
                     this.trace(
936 936
                         'createAnswerOnSuccess::postTransform (rtx modifier)',
@@ -1028,7 +1028,7 @@ TraceablePeerConnection.prototype.generateNewStreamSSRCInfo = function() {
1028 1028
             groups: []
1029 1029
         };
1030 1030
     }
1031
-    if (!this.options.disableRtx && !RTCBrowserType.isFirefox()) {
1031
+    if (!this.options.disableRtx && RTCBrowserType.supportsRtx()) {
1032 1032
         // Specifically use a for loop here because we'll
1033 1033
         //  be adding to the list we're iterating over, so we
1034 1034
         //  only want to iterate through the items originally

+ 1
- 1
modules/xmpp/xmpp.js 查看文件

@@ -82,7 +82,7 @@ export default class XMPP extends Listenable {
82 82
         this.caps.addFeature('urn:xmpp:jingle:apps:rtp:audio');
83 83
         this.caps.addFeature('urn:xmpp:jingle:apps:rtp:video');
84 84
 
85
-        if (!this.options.disableRtx && !RTCBrowserType.isFirefox()) {
85
+        if (!this.options.disableRtx && RTCBrowserType.supportsRtx()) {
86 86
             this.caps.addFeature('urn:ietf:rfc:4588');
87 87
         }
88 88
 

Loading…
取消
儲存