@wireapp/avs 10.0.2 → 10.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/avs_pc.js CHANGED
@@ -238,8 +238,9 @@ function update_tracks(pc, stream) {
238
238
  }
239
239
  }
240
240
  if (!found) {
241
- if (sender.track)
241
+ if (sender.track) {
242
242
  sender.track.enabled = false;
243
+ }
243
244
  }
244
245
  }
245
246
  var videoSenderUpdates = [];
@@ -252,38 +253,40 @@ function update_tracks(pc, stream) {
252
253
  }
253
254
  if (!replace_track(pc, track)) {
254
255
  pc_log(LOG_LEVEL_INFO, "update_tracks: adding track of kind=".concat(track.kind, ", id=").concat(track.id));
255
- if (track.kind === 'video') {
256
- var videoTrack_1 = track;
256
+ if (track.kind === 'video' && pc.conv_type !== CONV_TYPE_ONEONONE) {
257
257
  var transceivers = rtc.getTransceivers();
258
258
  var _loop_1 = function (trans) {
259
259
  if (trans.mid === 'video') {
260
260
  pc_log(LOG_LEVEL_INFO, "update_tracks: adjust");
261
261
  var params = trans.sender.getParameters();
262
- pc_log(LOG_LEVEL_INFO, "update_tracks: params ".concat(JSON.stringify(params)));
263
262
  if (!params.encodings) {
264
263
  pc_log(LOG_LEVEL_INFO, "update_tracks: no params");
265
264
  params.encodings = [];
266
265
  }
266
+ var layerFound_1 = false;
267
267
  params.encodings.forEach(function (coding) {
268
268
  if (coding.rid === 'l') {
269
- // @ts-ignore
269
+ //@ts-ignore
270
270
  coding.scalabilityMode = 'L1T1';
271
271
  coding.scaleResolutionDownBy = 4;
272
- coding.maxBitrate = 245760; // 240 * 1024
272
+ coding.active = true;
273
+ layerFound_1 = true;
273
274
  }
274
275
  if (coding.rid === 'h') {
275
- // @ts-ignore
276
+ //@ts-ignore
276
277
  coding.scalabilityMode = 'L1T1';
277
278
  coding.scaleResolutionDownBy = 1;
278
- coding.maxBitrate = 819200; // 800 * 1024
279
+ coding.active = true;
280
+ layerFound_1 = true;
279
281
  }
280
282
  });
281
283
  rtc.addTrack(track, stream);
282
- videoSenderUpdates.push(trans.sender.setParameters(params).catch(function (e) { return pc_log(LOG_LEVEL_ERROR, "update_tracks: set params ".concat(e)); })
283
- // Reinsert the track so that the changes are transferred to the track (needed for FF)
284
- .then(function () { return trans.sender.replaceTrack(videoTrack_1); })
285
- .then(function (e) { return pc_log(LOG_LEVEL_INFO, "update_tracks: stream added"); })
286
- .then());
284
+ if (layerFound_1) {
285
+ videoSenderUpdates.push(trans.sender.setParameters(params).catch(function (e) { return pc_log(LOG_LEVEL_ERROR, "update_tracks: set params ".concat(e)); })
286
+ // Reinsert the track so that the changes are transferred to the track (needed for FF)
287
+ .then(function () { return trans.sender.replaceTrack(track); })
288
+ .then());
289
+ }
287
290
  }
288
291
  };
289
292
  for (var _i = 0, transceivers_1 = transceivers; _i < transceivers_1.length; _i++) {
@@ -292,10 +295,15 @@ function update_tracks(pc, stream) {
292
295
  }
293
296
  }
294
297
  else {
295
- var sender = rtc.addTrack(track, stream);
298
+ rtc.addTrack(track, stream);
296
299
  }
297
300
  }
298
301
  });
302
+ // Either the codecs did not need to be adjusted because we are in a 1:1 call, or we are not sending a video track.
303
+ // In that case, there is no need to wait for the asynchronous process
304
+ if (videoSenderUpdates.length === 0) {
305
+ return Promise.resolve();
306
+ }
299
307
  // Wait until setup is finish
300
308
  return Promise.all(videoSenderUpdates).catch(function (e) {
301
309
  pc_log(LOG_LEVEL_ERROR, "update_tracks: error=".concat(e));
package/package.json CHANGED
@@ -21,5 +21,5 @@
21
21
  "prepack": "prettier -w src/avs_wcall.ts && tsc && cp src/*.js src/*.d.ts dist/",
22
22
  "test": "karma start"
23
23
  },
24
- "version": "10.0.2"
24
+ "version": "10.0.4"
25
25
  }