Selaa lähdekoodia

Adds start silent config, to disable send/receive audio.

dev1
damencho 6 vuotta sitten
vanhempi
commit
0a5eaf3d36

+ 12
- 8
JitsiConferenceEventManager.js Näytä tiedosto

644
         conference.eventEmitter.emit(
644
         conference.eventEmitter.emit(
645
             JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED);
645
             JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED);
646
     });
646
     });
647
-    conference.statistics.addByteSentStatsListener((tpc, stats) => {
648
-        conference.getLocalTracks(MediaType.AUDIO).forEach(track => {
649
-            const ssrc = tpc.getLocalSSRC(track);
650
 
647
 
651
-            if (!ssrc || !stats.hasOwnProperty(ssrc)) {
652
-                return;
653
-            }
648
+    // if we are in startSilent mode we will not be sending/receiving so nothing to detect
649
+    if (!conference.options.config.startSilent) {
650
+        conference.statistics.addByteSentStatsListener((tpc, stats) => {
651
+            conference.getLocalTracks(MediaType.AUDIO).forEach(track => {
652
+                const ssrc = tpc.getLocalSSRC(track);
653
+
654
+                if (!ssrc || !stats.hasOwnProperty(ssrc)) {
655
+                    return;
656
+                }
654
 
657
 
655
-            track._onByteSentStatsReceived(tpc, stats[ssrc]);
658
+                track._onByteSentStatsReceived(tpc, stats[ssrc]);
659
+            });
656
         });
660
         });
657
-    });
661
+    }
658
 };
662
 };

+ 2
- 1
doc/API.md Näytä tiedosto

225
         6. enableTalkWhileMuted - boolean property. Enables/disables talk while muted detection, by default the value is false/disabled.
225
         6. enableTalkWhileMuted - boolean property. Enables/disables talk while muted detection, by default the value is false/disabled.
226
         7. ignoreStartMuted - ignores start muted events coming from jicofo.
226
         7. ignoreStartMuted - ignores start muted events coming from jicofo.
227
         8. enableStatsID - enables sending callStatsUsername as stats-id in presence, jicofo and videobridge will use it as endpointID to report stats
227
         8. enableStatsID - enables sending callStatsUsername as stats-id in presence, jicofo and videobridge will use it as endpointID to report stats
228
-        9. enableDisplayNameInStats - enables sending the users display name, if set, to callstats as alias of the endpointID stats 
228
+        9. enableDisplayNameInStats - enables sending the users display name, if set, to callstats as alias of the endpointID stats
229
+        10. startSilent - enables silent mode, will mark audio as inactive will not send/receive audio
229
 
230
 
230
         **NOTE: if 4 and 5 are set the library is going to send events to callstats. Otherwise the callstats integration will be disabled.**
231
         **NOTE: if 4 and 5 are set the library is going to send events to callstats. Otherwise the callstats integration will be disabled.**
231
 
232
 

+ 1
- 0
modules/RTC/RTC.js Näytä tiedosto

494
      *      disabled by removing it from the SDP.
494
      *      disabled by removing it from the SDP.
495
      * @param {boolean} options.preferH264 If set to 'true' H264 will be
495
      * @param {boolean} options.preferH264 If set to 'true' H264 will be
496
      *      preferred over other video codecs.
496
      *      preferred over other video codecs.
497
+     * @param {boolean} options.startSilent If set to 'true' no audio will be sent or received.
497
      * @return {TraceablePeerConnection}
498
      * @return {TraceablePeerConnection}
498
      */
499
      */
499
     createPeerConnection(signaling, iceConfig, isP2P, options) {
500
     createPeerConnection(signaling, iceConfig, isP2P, options) {

+ 12
- 5
modules/RTC/TraceablePeerConnection.js Näytä tiedosto

52
  * @param {boolean} options.enableLayerSuspension if set to 'true', we will
52
  * @param {boolean} options.enableLayerSuspension if set to 'true', we will
53
  * cap the video send bitrate when we are told we have not been selected by
53
  * cap the video send bitrate when we are told we have not been selected by
54
  * any endpoints (and therefore the non-thumbnail streams are not in use).
54
  * any endpoints (and therefore the non-thumbnail streams are not in use).
55
+ * @param {boolean} options.startSilent If set to 'true' no audio will be sent or received.
55
  *
56
  *
56
  * FIXME: initially the purpose of TraceablePeerConnection was to be able to
57
  * FIXME: initially the purpose of TraceablePeerConnection was to be able to
57
  * debug the peer connection. Since many other responsibilities have been added
58
  * debug the peer connection. Since many other responsibilities have been added
77
      * @type {boolean}
78
      * @type {boolean}
78
      * @private
79
      * @private
79
      */
80
      */
80
-    this.audioTransferActive = true;
81
+    this.audioTransferActive = !(options.startSilent === true);
81
 
82
 
82
     /**
83
     /**
83
      * Indicates whether or not this peer connection instance is actively
84
      * Indicates whether or not this peer connection instance is actively
1166
 /**
1167
 /**
1167
  * Makes sure that both audio and video directions are configured as 'sendrecv'.
1168
  * Makes sure that both audio and video directions are configured as 'sendrecv'.
1168
  * @param {Object} localDescription the SDP object as defined by WebRTC.
1169
  * @param {Object} localDescription the SDP object as defined by WebRTC.
1170
+ * @param {object} options <tt>TracablePeerConnection</tt> config options.
1169
  */
1171
  */
1170
-const enforceSendRecv = function(localDescription) {
1172
+const enforceSendRecv = function(localDescription, options) {
1171
     if (!localDescription) {
1173
     if (!localDescription) {
1172
         throw new Error('No local description passed in.');
1174
         throw new Error('No local description passed in.');
1173
     }
1175
     }
1177
     let changed = false;
1179
     let changed = false;
1178
 
1180
 
1179
     if (audioMedia && audioMedia.direction !== 'sendrecv') {
1181
     if (audioMedia && audioMedia.direction !== 'sendrecv') {
1180
-        audioMedia.direction = 'sendrecv';
1182
+        if (options.startSilent) {
1183
+            audioMedia.direction = 'inactive';
1184
+        } else {
1185
+            audioMedia.direction = 'sendrecv';
1186
+        }
1187
+
1181
         changed = true;
1188
         changed = true;
1182
     }
1189
     }
1183
 
1190
 
1298
         // Note that the description we set in chrome does have the accurate
1305
         // Note that the description we set in chrome does have the accurate
1299
         // direction (e.g. 'recvonly'), since that is technically what is
1306
         // direction (e.g. 'recvonly'), since that is technically what is
1300
         // happening (check setLocalDescription impl).
1307
         // happening (check setLocalDescription impl).
1301
-        desc = enforceSendRecv(desc);
1308
+        desc = enforceSendRecv(desc, this.options);
1302
 
1309
 
1303
         // See the method's doc for more info about this transformation.
1310
         // See the method's doc for more info about this transformation.
1304
         desc = this.localSdpMunger.transformStreamIdentifiers(desc);
1311
         desc = this.localSdpMunger.transformStreamIdentifiers(desc);
1810
  * disabled the SDP audio media direction in the local SDP will be adjusted to
1817
  * disabled the SDP audio media direction in the local SDP will be adjusted to
1811
  * 'inactive' which means that no data will be sent nor accepted, but
1818
  * 'inactive' which means that no data will be sent nor accepted, but
1812
  * the connection should be kept alive.
1819
  * the connection should be kept alive.
1813
- * @param {boolean} active <tt>true</tt> to enable video media transmission or
1820
+ * @param {boolean} active <tt>true</tt> to enable audio media transmission or
1814
  * <tt>false</tt> to disable. If the value is not a boolean the call will have
1821
  * <tt>false</tt> to disable. If the value is not a boolean the call will have
1815
  * no effect.
1822
  * no effect.
1816
  * @return {boolean} <tt>true</tt> if the value has changed and sRD/sLD cycle
1823
  * @return {boolean} <tt>true</tt> if the value has changed and sRD/sLD cycle

+ 4
- 0
modules/xmpp/JingleSessionPC.js Näytä tiedosto

304
             pcOptions.enableLayerSuspension = options.enableLayerSuspension;
304
             pcOptions.enableLayerSuspension = options.enableLayerSuspension;
305
         }
305
         }
306
 
306
 
307
+        if (options.startSilent) {
308
+            pcOptions.startSilent = true;
309
+        }
310
+
307
         this.peerconnection
311
         this.peerconnection
308
             = this.rtc.createPeerConnection(
312
             = this.rtc.createPeerConnection(
309
                     this.signalingLayer,
313
                     this.signalingLayer,

Loading…
Peruuta
Tallenna