浏览代码

Removes misleading documentation. Formatting fixes.

master
Boris Grozev 9 年前
父节点
当前提交
68421465a7
共有 2 个文件被更改,包括 21 次插入22 次删除
  1. 17
    20
      modules/xmpp/SDPDiffer.js
  2. 4
    2
      modules/xmpp/TraceablePeerConnection.js

+ 17
- 20
modules/xmpp/SDPDiffer.js 查看文件

1
-
2
 var SDPUtil = require("./SDPUtil");
1
 var SDPUtil = require("./SDPUtil");
3
 
2
 
4
-function SDPDiffer(mySDP, otherSDP) {
3
+function SDPDiffer(mySDP, otherSDP)
4
+{
5
     this.mySDP = mySDP;
5
     this.mySDP = mySDP;
6
     this.otherSDP = otherSDP;
6
     this.otherSDP = otherSDP;
7
 }
7
 }
8
 
8
 
9
 /**
9
 /**
10
- * Returns map of MediaChannel that contains only media not contained in <tt>otherSdp</tt>. Mapped by channel idx.
11
- * @param otherSdp the other SDP to check ssrc with.
10
+ * Returns map of MediaChannel that contains media contained in
11
+ * 'mySDP', but not contained in 'otherSdp'. Mapped by channel idx.
12
  */
12
  */
13
 SDPDiffer.prototype.getNewMedia = function() {
13
 SDPDiffer.prototype.getNewMedia = function() {
14
 
14
 
30
                     return false;
30
                     return false;
31
             }
31
             }
32
             else if (this[i] != array[i]) {
32
             else if (this[i] != array[i]) {
33
-                // Warning - two different object instances will never be equal: {x:20} != {x:20}
33
+                // Warning - two different object instances will never be
34
+                // equal: {x:20} != {x:20}
34
                 return false;
35
                 return false;
35
             }
36
             }
36
         }
37
         }
48
             newMedia[othersMediaIdx] = othersMedia;
49
             newMedia[othersMediaIdx] = othersMedia;
49
             return;
50
             return;
50
         }
51
         }
51
-        // Look for new ssrcs accross the channel
52
+        // Look for new ssrcs across the channel
52
         Object.keys(othersMedia.ssrcs).forEach(function(ssrc) {
53
         Object.keys(othersMedia.ssrcs).forEach(function(ssrc) {
53
             if(Object.keys(myMedia.ssrcs).indexOf(ssrc) === -1) {
54
             if(Object.keys(myMedia.ssrcs).indexOf(ssrc) === -1) {
54
-                // Allocate channel if we've found ssrc that doesn't exist in our channel
55
+                // Allocate channel if we've found ssrc that doesn't exist in
56
+                // our channel
55
                 if(!newMedia[othersMediaIdx]){
57
                 if(!newMedia[othersMediaIdx]){
56
                     newMedia[othersMediaIdx] = {
58
                     newMedia[othersMediaIdx] = {
57
                         mediaindex: othersMedia.mediaindex,
59
                         mediaindex: othersMedia.mediaindex,
71
             var matched = false;
73
             var matched = false;
72
             for (var i = 0; i < myMedia.ssrcGroups.length; i++) {
74
             for (var i = 0; i < myMedia.ssrcGroups.length; i++) {
73
                 var mySsrcGroup = myMedia.ssrcGroups[i];
75
                 var mySsrcGroup = myMedia.ssrcGroups[i];
74
-                if (otherSsrcGroup.semantics == mySsrcGroup.semantics
75
-                    && arrayEquals.apply(otherSsrcGroup.ssrcs, [mySsrcGroup.ssrcs])) {
76
+                if (otherSsrcGroup.semantics == mySsrcGroup.semantics &&
77
+                    arrayEquals.apply(otherSsrcGroup.ssrcs,
78
+                                      [mySsrcGroup.ssrcs])) {
76
 
79
 
77
                     matched = true;
80
                     matched = true;
78
                     break;
81
                     break;
99
 };
102
 };
100
 
103
 
101
 /**
104
 /**
102
- * Sends SSRC update IQ.
103
- * @param sdpMediaSsrcs SSRCs map obtained from SDP.getNewMedia. Cntains SSRCs to add/remove.
104
- * @param sid session identifier that will be put into the IQ.
105
- * @param initiator initiator identifier.
106
- * @param toJid destination Jid
107
- * @param isAdd indicates if this is remove or add operation.
105
+ * TODO: document!
108
  */
106
  */
109
 SDPDiffer.prototype.toJingle = function(modify) {
107
 SDPDiffer.prototype.toJingle = function(modify) {
110
     var sdpMediaSsrcs = this.getNewMedia();
108
     var sdpMediaSsrcs = this.getNewMedia();
111
-    var self = this;
112
 
109
 
113
-    // FIXME: only announce video ssrcs since we mix audio and dont need
114
-    //      the audio ssrcs therefore
115
     var modified = false;
110
     var modified = false;
116
     Object.keys(sdpMediaSsrcs).forEach(function(mediaindex){
111
     Object.keys(sdpMediaSsrcs).forEach(function(mediaindex){
117
         modified = true;
112
         modified = true;
118
         var media = sdpMediaSsrcs[mediaindex];
113
         var media = sdpMediaSsrcs[mediaindex];
119
         modify.c('content', {name: media.mid});
114
         modify.c('content', {name: media.mid});
120
 
115
 
121
-        modify.c('description', {xmlns:'urn:xmpp:jingle:apps:rtp:1', media: media.mid});
122
-        // FIXME: not completly sure this operates on blocks and / or handles different ssrcs correctly
116
+        modify.c('description',
117
+                 {xmlns:'urn:xmpp:jingle:apps:rtp:1', media: media.mid});
118
+        // FIXME: not completely sure this operates on blocks and / or handles
119
+        // different ssrcs correctly
123
         // generate sources from lines
120
         // generate sources from lines
124
         Object.keys(media.ssrcs).forEach(function(ssrcNum) {
121
         Object.keys(media.ssrcs).forEach(function(ssrcNum) {
125
             var mediaSsrc = media.ssrcs[ssrcNum];
122
             var mediaSsrc = media.ssrcs[ssrcNum];

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

1
+/* global $ */
1
 var RTC = require('../RTC/RTC');
2
 var RTC = require('../RTC/RTC');
2
 var RTCBrowserType = require("../RTC/RTCBrowserType.js");
3
 var RTCBrowserType = require("../RTC/RTCBrowserType.js");
3
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
4
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
174
             }
175
             }
175
 
176
 
176
             if (typeof mLine.ssrcs !== 'undefined' && Array.isArray(mLine.ssrcs)) {
177
             if (typeof mLine.ssrcs !== 'undefined' && Array.isArray(mLine.ssrcs)) {
177
-                for (var i = 0; i<mLine.ssrcs.length; i++){
178
+                var i;
179
+                for (i = 0; i<mLine.ssrcs.length; i++){
178
                     if (typeof mLine.ssrcs[i] === 'object'
180
                     if (typeof mLine.ssrcs[i] === 'object'
179
                         && typeof mLine.ssrcs[i].id !== 'undefined'
181
                         && typeof mLine.ssrcs[i].id !== 'undefined'
180
                         && $.inArray(mLine.ssrcs[i].id, firstSsrcs) == 0) {
182
                         && $.inArray(mLine.ssrcs[i].id, firstSsrcs) == 0) {
183
                     }
185
                     }
184
                 }
186
                 }
185
 
187
 
186
-                for (var i = 0; i<mLine.ssrcs.length; i++){
188
+                for (i = 0; i<mLine.ssrcs.length; i++){
187
                     if (typeof mLine.ssrcs[i] !== 'undefined') {
189
                     if (typeof mLine.ssrcs[i] !== 'undefined') {
188
                         newSsrcLines.push(mLine.ssrcs[i]);
190
                         newSsrcLines.push(mLine.ssrcs[i]);
189
                     }
191
                     }

正在加载...
取消
保存