瀏覽代碼

Simplify, clarify source code

master
Lyubomir Marinov 9 年之前
父節點
當前提交
e165952a5d

+ 0
- 1
modules/RTC/JitsiRemoteTrack.js 查看文件

30
  * @param value the muted status.
30
  * @param value the muted status.
31
  */
31
  */
32
 JitsiRemoteTrack.prototype.setMute = function (value) {
32
 JitsiRemoteTrack.prototype.setMute = function (value) {
33
-
34
     if(this.muted === value)
33
     if(this.muted === value)
35
         return;
34
         return;
36
 
35
 

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

227
  * Returns true if this is a video track and the source of the video is a
227
  * Returns true if this is a video track and the source of the video is a
228
  * screen capture as opposed to a camera.
228
  * screen capture as opposed to a camera.
229
  */
229
  */
230
-JitsiTrack.prototype.isScreenSharing = function(){
231
-
230
+JitsiTrack.prototype.isScreenSharing = function() {
232
 };
231
 };
233
 
232
 
234
 /**
233
 /**
258
  * @returns {boolean} whether MediaStream is active.
257
  * @returns {boolean} whether MediaStream is active.
259
  */
258
  */
260
 JitsiTrack.prototype.isActive = function () {
259
 JitsiTrack.prototype.isActive = function () {
261
-    if((typeof this.stream.active !== "undefined"))
260
+    if(typeof this.stream.active !== "undefined")
262
         return this.stream.active;
261
         return this.stream.active;
263
     else
262
     else
264
         return true;
263
         return true;
289
 JitsiTrack.prototype.addEventListener = JitsiTrack.prototype.on;
288
 JitsiTrack.prototype.addEventListener = JitsiTrack.prototype.on;
290
 JitsiTrack.prototype.removeEventListener = JitsiTrack.prototype.off;
289
 JitsiTrack.prototype.removeEventListener = JitsiTrack.prototype.off;
291
 
290
 
292
-
293
 /**
291
 /**
294
  * Sets the audio level for the stream
292
  * Sets the audio level for the stream
295
  * @param audioLevel the new audio level
293
  * @param audioLevel the new audio level

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

642
                     return SDPUtil.filter_special_chars(stream.id);
642
                     return SDPUtil.filter_special_chars(stream.id);
643
                 };
643
                 };
644
                 this.getVideoSrc = function (element) {
644
                 this.getVideoSrc = function (element) {
645
-                    if (!element)
646
-                        return null;
647
-                    return element.getAttribute("src");
645
+                    return element ? element.getAttribute("src") : null;
648
                 };
646
                 };
649
                 this.setVideoSrc = function (element, src) {
647
                 this.setVideoSrc = function (element, src) {
650
-                    if (!src) {
651
-                        src = '';
652
-                    }
653
                     if (element)
648
                     if (element)
654
-                        element.setAttribute("src", src);
649
+                        element.setAttribute("src", src || '');
655
                 };
650
                 };
656
                 // DTLS should now be enabled by default but..
651
                 // DTLS should now be enabled by default but..
657
                 this.pc_constraints = {'optional': [
652
                 this.pc_constraints = {'optional': [

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

704
 ChatRoom.prototype.remoteTrackAdded = function(data) {
704
 ChatRoom.prototype.remoteTrackAdded = function(data) {
705
     // Will figure out current muted status by looking up owner's presence
705
     // Will figure out current muted status by looking up owner's presence
706
     var pres = this.lastPresences[data.owner];
706
     var pres = this.lastPresences[data.owner];
707
-    var mediaType = data.mediaType;
708
     if(pres) {
707
     if(pres) {
708
+        var mediaType = data.mediaType;
709
         var mutedNode = null;
709
         var mutedNode = null;
710
         if (mediaType === MediaType.AUDIO) {
710
         if (mediaType === MediaType.AUDIO) {
711
             mutedNode = filterNodeFromPresenceJSON(pres, "audiomuted");
711
             mutedNode = filterNodeFromPresenceJSON(pres, "audiomuted");

+ 3
- 6
modules/xmpp/JingleSessionPC.js 查看文件

1257
     }
1257
     }
1258
 
1258
 
1259
     var remoteSDP = new SDP(this.peerconnection.remoteDescription.sdp);
1259
     var remoteSDP = new SDP(this.peerconnection.remoteDescription.sdp);
1260
-    var medialines = remoteSDP.media.filter(function (mediaLines){
1260
+    var medialines = remoteSDP.media.filter(function (mediaLines) {
1261
         return mediaLines.startsWith("m=" + mediaType);
1261
         return mediaLines.startsWith("m=" + mediaType);
1262
     });
1262
     });
1263
 
1263
 
1268
 
1268
 
1269
     var ssrclines = SDPUtil.find_lines(medialines[0], 'a=ssrc:');
1269
     var ssrclines = SDPUtil.find_lines(medialines[0], 'a=ssrc:');
1270
     ssrclines = ssrclines.filter(function (line) {
1270
     ssrclines = ssrclines.filter(function (line) {
1271
-        if (RTCBrowserType.isTemasysPluginUsed()) {
1272
-            return ((line.indexOf('mslabel:' + streamId) !== -1));
1273
-        } else {
1274
-            return ((line.indexOf('msid:' + streamId) !== -1));
1275
-        }
1271
+        var msid = RTCBrowserType.isTemasysPluginUsed() ? 'mslabel' : 'msid';
1272
+        return line.indexOf(msid + ':' + streamId) !== -1;
1276
     });
1273
     });
1277
 
1274
 
1278
     var thessrc;
1275
     var thessrc;

Loading…
取消
儲存