Quellcode durchsuchen

Renames confusingly named functions, adds documentation.

master
Boris Grozev vor 9 Jahren
Ursprung
Commit
6cfd1ba968
3 geänderte Dateien mit 18 neuen und 11 gelöschten Zeilen
  1. 1
    1
      JitsiConference.js
  2. 14
    7
      modules/RTC/DataChannels.js
  3. 3
    3
      modules/RTC/RTC.js

+ 1
- 1
JitsiConference.js Datei anzeigen

@@ -526,7 +526,7 @@ JitsiConference.prototype.unlock = function () {
526 526
  */
527 527
 JitsiConference.prototype.selectParticipant = function(participantId) {
528 528
     if (this.rtc) {
529
-        this.rtc.selectedEndpoint(participantId);
529
+        this.rtc.selectEndpoint(participantId);
530 530
     }
531 531
 };
532 532
 

+ 14
- 7
modules/RTC/DataChannels.js Datei anzeigen

@@ -51,7 +51,7 @@ function DataChannels(peerConnection, emitter) {
51 51
 DataChannels.prototype.onDataChannel = function (event) {
52 52
     var dataChannel = event.channel;
53 53
     var self = this;
54
-    var lastSelectedEndpoint = null;
54
+    var selectedEndpoint = null;
55 55
 
56 56
     dataChannel.onopen = function () {
57 57
         logger.info("Data channel opened by the Videobridge!", dataChannel);
@@ -68,7 +68,8 @@ DataChannels.prototype.onDataChannel = function (event) {
68 68
         // selections so that it can do adaptive simulcast,
69 69
         // we want the notification to trigger even if userJid is undefined,
70 70
         // or null.
71
-        self.handleSelectedEndpointEvent(self.lastSelectedEndpoint);
71
+        // XXX why do we not do the same for pinned endpoints?
72
+        self.sendSelectedEndpointMessage(self.selectedEndpoint);
72 73
     };
73 74
 
74 75
     dataChannel.onerror = function (error) {
@@ -173,13 +174,19 @@ DataChannels.prototype.closeAllChannels = function () {
173 174
     });
174 175
 };
175 176
 
176
-DataChannels.prototype.handleSelectedEndpointEvent = function (userResource) {
177
-    this.lastSelectedEndpoint = userResource;
178
-    this._onXXXEndpointChanged("selected", userResource);
177
+/**
178
+ * Sends a "selected endpoint changed" message via the data channel.
179
+ */
180
+DataChannels.prototype.sendSelectedEndpointMessage = function (endpointId) {
181
+    this.selectedEndpoint = endpointId;
182
+    this._onXXXEndpointChanged("selected", endpointId);
179 183
 };
180 184
 
181
-DataChannels.prototype.handlePinnedEndpointEvent = function (userResource) {
182
-    this._onXXXEndpointChanged("pinnned", userResource);
185
+/**
186
+ * Sends a "pinned endpoint changed" message via the data channel.
187
+ */
188
+DataChannels.prototype.sendPinnedEndpointMessage = function (endpointId) {
189
+    this._onXXXEndpointChanged("pinnned", endpointId);
183 190
 };
184 191
 
185 192
 /**

+ 3
- 3
modules/RTC/RTC.js Datei anzeigen

@@ -141,14 +141,14 @@ RTC.prototype.onIncommingCall = function(event) {
141 141
     }.bind(this));
142 142
 };
143 143
 
144
-RTC.prototype.selectedEndpoint = function (id) {
144
+RTC.prototype.selectEndpoint = function (id) {
145 145
     if(this.dataChannels)
146
-        this.dataChannels.handleSelectedEndpointEvent(id);
146
+        this.dataChannels.sendSelectedEndpointMessage(id);
147 147
 };
148 148
 
149 149
 RTC.prototype.pinEndpoint = function (id) {
150 150
     if(this.dataChannels)
151
-        this.dataChannels.handlePinnedEndpointEvent(id);
151
+        this.dataChannels.sendPinnedEndpointMessage(id);
152 152
 };
153 153
 
154 154
 RTC.prototype.addListener = function (type, listener) {

Laden…
Abbrechen
Speichern