Bladeren bron

Removes misleading documentation. Formatting fixes.

master
Boris Grozev 9 jaren geleden
bovenliggende
commit
68421465a7
2 gewijzigde bestanden met toevoegingen van 21 en 22 verwijderingen
  1. 17
    20
      modules/xmpp/SDPDiffer.js
  2. 4
    2
      modules/xmpp/TraceablePeerConnection.js

+ 17
- 20
modules/xmpp/SDPDiffer.js Bestand weergeven

@@ -1,14 +1,14 @@
1
-
2 1
 var SDPUtil = require("./SDPUtil");
3 2
 
4
-function SDPDiffer(mySDP, otherSDP) {
3
+function SDPDiffer(mySDP, otherSDP)
4
+{
5 5
     this.mySDP = mySDP;
6 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 13
 SDPDiffer.prototype.getNewMedia = function() {
14 14
 
@@ -30,7 +30,8 @@ SDPDiffer.prototype.getNewMedia = function() {
30 30
                     return false;
31 31
             }
32 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 35
                 return false;
35 36
             }
36 37
         }
@@ -48,10 +49,11 @@ SDPDiffer.prototype.getNewMedia = function() {
48 49
             newMedia[othersMediaIdx] = othersMedia;
49 50
             return;
50 51
         }
51
-        // Look for new ssrcs accross the channel
52
+        // Look for new ssrcs across the channel
52 53
         Object.keys(othersMedia.ssrcs).forEach(function(ssrc) {
53 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 57
                 if(!newMedia[othersMediaIdx]){
56 58
                     newMedia[othersMediaIdx] = {
57 59
                         mediaindex: othersMedia.mediaindex,
@@ -71,8 +73,9 @@ SDPDiffer.prototype.getNewMedia = function() {
71 73
             var matched = false;
72 74
             for (var i = 0; i < myMedia.ssrcGroups.length; i++) {
73 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 80
                     matched = true;
78 81
                     break;
@@ -99,27 +102,21 @@ SDPDiffer.prototype.getNewMedia = function() {
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 107
 SDPDiffer.prototype.toJingle = function(modify) {
110 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 110
     var modified = false;
116 111
     Object.keys(sdpMediaSsrcs).forEach(function(mediaindex){
117 112
         modified = true;
118 113
         var media = sdpMediaSsrcs[mediaindex];
119 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 120
         // generate sources from lines
124 121
         Object.keys(media.ssrcs).forEach(function(ssrcNum) {
125 122
             var mediaSsrc = media.ssrcs[ssrcNum];

+ 4
- 2
modules/xmpp/TraceablePeerConnection.js Bestand weergeven

@@ -1,3 +1,4 @@
1
+/* global $ */
1 2
 var RTC = require('../RTC/RTC');
2 3
 var RTCBrowserType = require("../RTC/RTCBrowserType.js");
3 4
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
@@ -174,7 +175,8 @@ var normalizePlanB = function(desc) {
174 175
             }
175 176
 
176 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 180
                     if (typeof mLine.ssrcs[i] === 'object'
179 181
                         && typeof mLine.ssrcs[i].id !== 'undefined'
180 182
                         && $.inArray(mLine.ssrcs[i].id, firstSsrcs) == 0) {
@@ -183,7 +185,7 @@ var normalizePlanB = function(desc) {
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 189
                     if (typeof mLine.ssrcs[i] !== 'undefined') {
188 190
                         newSsrcLines.push(mLine.ssrcs[i]);
189 191
                     }

Laden…
Annuleren
Opslaan