|
@@ -52,6 +52,7 @@ const SIM_LAYER_RIDS = [ SIM_LAYER_1_RID, SIM_LAYER_2_RID, SIM_LAYER_3_RID ];
|
52
|
52
|
* @param {boolean} options.enableLayerSuspension if set to 'true', we will
|
53
|
53
|
* cap the video send bitrate when we are told we have not been selected by
|
54
|
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
|
57
|
* FIXME: initially the purpose of TraceablePeerConnection was to be able to
|
57
|
58
|
* debug the peer connection. Since many other responsibilities have been added
|
|
@@ -77,7 +78,7 @@ export default function TraceablePeerConnection(
|
77
|
78
|
* @type {boolean}
|
78
|
79
|
* @private
|
79
|
80
|
*/
|
80
|
|
- this.audioTransferActive = true;
|
|
81
|
+ this.audioTransferActive = !(options.startSilent === true);
|
81
|
82
|
|
82
|
83
|
/**
|
83
|
84
|
* Indicates whether or not this peer connection instance is actively
|
|
@@ -1166,8 +1167,9 @@ function replaceDefaultUnifiedPlanMsid(ssrcLines = []) {
|
1166
|
1167
|
/**
|
1167
|
1168
|
* Makes sure that both audio and video directions are configured as 'sendrecv'.
|
1168
|
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
|
1173
|
if (!localDescription) {
|
1172
|
1174
|
throw new Error('No local description passed in.');
|
1173
|
1175
|
}
|
|
@@ -1177,7 +1179,12 @@ const enforceSendRecv = function(localDescription) {
|
1177
|
1179
|
let changed = false;
|
1178
|
1180
|
|
1179
|
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
|
1188
|
changed = true;
|
1182
|
1189
|
}
|
1183
|
1190
|
|
|
@@ -1298,7 +1305,7 @@ const getters = {
|
1298
|
1305
|
// Note that the description we set in chrome does have the accurate
|
1299
|
1306
|
// direction (e.g. 'recvonly'), since that is technically what is
|
1300
|
1307
|
// happening (check setLocalDescription impl).
|
1301
|
|
- desc = enforceSendRecv(desc);
|
|
1308
|
+ desc = enforceSendRecv(desc, this.options);
|
1302
|
1309
|
|
1303
|
1310
|
// See the method's doc for more info about this transformation.
|
1304
|
1311
|
desc = this.localSdpMunger.transformStreamIdentifiers(desc);
|
|
@@ -1810,7 +1817,7 @@ TraceablePeerConnection.prototype.setLocalDescription = function(description) {
|
1810
|
1817
|
* disabled the SDP audio media direction in the local SDP will be adjusted to
|
1811
|
1818
|
* 'inactive' which means that no data will be sent nor accepted, but
|
1812
|
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
|
1821
|
* <tt>false</tt> to disable. If the value is not a boolean the call will have
|
1815
|
1822
|
* no effect.
|
1816
|
1823
|
* @return {boolean} <tt>true</tt> if the value has changed and sRD/sLD cycle
|