@wireapp/avs 10.5.43 → 10.6.2

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
@@ -388,6 +388,35 @@ function ccallLocalSdpHandler(pc, err, type, sdp) {
388
388
  function ccallStartGatherHandler(pc) {
389
389
  em_module.ccall("pc_start_gather_handler", null, ["number"], [pc.self]);
390
390
  }
391
+ function ccallAudioJbMinMs() {
392
+ return em_module.ccall("pc_audio_jb_min_ms", "number", [], []);
393
+ }
394
+ /* Give the received audio the same jitter buffer minimum as the native
395
+ * clients (wcall_set_loss_params jb_min_ms), so the packet carrying the RED /
396
+ * FEC copy of a lost one arrives in time.
397
+ */
398
+ function setAudioJitterBufferMin(pc, receiver) {
399
+ var ms = ccallAudioJbMinMs();
400
+ if (ms <= 0)
401
+ return;
402
+ var r = receiver;
403
+ try {
404
+ if ('jitterBufferTarget' in r) {
405
+ r.jitterBufferTarget = ms;
406
+ }
407
+ else if ('playoutDelayHint' in r) {
408
+ r.playoutDelayHint = ms / 1000;
409
+ }
410
+ else {
411
+ pc_log(LOG_LEVEL_INFO, "setAudioJitterBufferMin: self=".concat(pc.self, " not supported"));
412
+ return;
413
+ }
414
+ pc_log(LOG_LEVEL_INFO, "setAudioJitterBufferMin: self=".concat(pc.self, " ").concat(ms, " ms"));
415
+ }
416
+ catch (err) {
417
+ pc_log(LOG_LEVEL_WARN, "setAudioJitterBufferMin failed: " + err, err);
418
+ }
419
+ }
391
420
  function ccallSignallingHandler(pc, state) {
392
421
  em_module.ccall("pc_signalling_handler", null, ["number", "number"], [pc.self, state]);
393
422
  }
@@ -635,6 +664,8 @@ function pc_Create(hnd, privacy, conv_type) {
635
664
  }
636
665
  }
637
666
  }
667
+ if (event.track.kind == "audio")
668
+ setAudioJitterBufferMin(pc, event.receiver);
638
669
  if (event.track.kind == "audio" && audioStreamHandler) {
639
670
  pc_log(LOG_LEVEL_INFO, "onTrack: calling ash(".concat(pc.convid.substring(0, 8), ", ").concat(label, ") with ").concat(event.streams.length, " streams"));
640
671
  audioStreamHandler(pc.convid, hnd.toString() + label, event.streams);
@@ -801,7 +832,9 @@ function sdpCbrMap(sdp) {
801
832
  sdp.split('\r\n').forEach(function (sdpLine) {
802
833
  var outline;
803
834
  outline = sdpLine;
804
- if (sdpLine.endsWith('sprop-stereo=0;useinbandfec=1')) {
835
+ // match the opus fmtp regardless of param order or appended params
836
+ // (e.g. maxaveragebitrate)
837
+ if (/^a=fmtp:\d+ .*useinbandfec=1/.test(sdpLine) && !sdpLine.includes('cbr=1')) {
805
838
  outline = sdpLine + ";cbr=1";
806
839
  }
807
840
  else if (sdpLine.startsWith('a=ssrc-group:')) {
@@ -169,12 +169,15 @@ export declare class Wcall {
169
169
  propsyncRequest(wuser: number, convid: string): void;
170
170
  enablePrivacy(wuser: number, enabled: number): void;
171
171
  setProxy(host: string, port: number): number;
172
+ setAudioParams(ptime: number, max_bitrate: number): void;
173
+ setLossParams(red: number, fec_loss_pct: number, max_bitrate: number, jb_min_ms: number): void;
172
174
  setReqClientsHandler(wuser: number, reqch: WcallReqClientsHandler): void;
173
175
  setClientsForConv(wuser: number, convid: string, json: string): number;
174
176
  setActiveSpeakerHandler(wuser: number, activeh: WcallActiveSpeakerHandler): void;
175
177
  requestVideoStreams(wuser: number, convid: string, mode: number, json: string): number;
176
178
  processNotifications(wuser: number, processing: number): number;
177
- audioRecord(wuser: number, path: string): number;
179
+ audioRecord(wuser: number, convid: string, path: string): number;
180
+ setAudioFiles(wuser: number, play_path: string, record_path: string): number;
178
181
  poll(): void;
179
182
  setupEx(flags: number): number;
180
183
  eventCreate(userid: string, clientid: string, incomingh: WcallIncomingHandler, missedh: WcallMissedHandler, closeh: WcallCloseHandler, arg?: number): number;
package/dist/avs_wcall.js CHANGED
@@ -575,6 +575,12 @@ var Wcall = /** @class */ (function () {
575
575
  Wcall.prototype.setProxy = function (host, port) {
576
576
  return this.em_module.ccall("wcall_set_proxy", "number", ["string", "number"], [host, port]);
577
577
  };
578
+ Wcall.prototype.setAudioParams = function (ptime, max_bitrate) {
579
+ this.em_module.ccall("wcall_set_audio_params", "null", ["number", "number"], [ptime, max_bitrate]);
580
+ };
581
+ Wcall.prototype.setLossParams = function (red, fec_loss_pct, max_bitrate, jb_min_ms) {
582
+ this.em_module.ccall("wcall_set_loss_params", "null", ["number", "number", "number", "number"], [red, fec_loss_pct, max_bitrate, jb_min_ms]);
583
+ };
578
584
  Wcall.prototype.setReqClientsHandler = function (wuser, reqch) {
579
585
  var _this = this;
580
586
  var fn_reqch = this.em_module.addFunction(function (wuser, convid, arg) {
@@ -602,8 +608,11 @@ var Wcall = /** @class */ (function () {
602
608
  Wcall.prototype.processNotifications = function (wuser, processing) {
603
609
  return this.em_module.ccall("wcall_process_notifications", "number", ["number", "number"], [wuser, processing]);
604
610
  };
605
- Wcall.prototype.audioRecord = function (wuser, path) {
606
- return this.em_module.ccall("wcall_audio_record", "number", ["number", "string"], [wuser, path]);
611
+ Wcall.prototype.audioRecord = function (wuser, convid, path) {
612
+ return this.em_module.ccall("wcall_audio_record", "number", ["number", "string", "string"], [wuser, convid, path]);
613
+ };
614
+ Wcall.prototype.setAudioFiles = function (wuser, play_path, record_path) {
615
+ return this.em_module.ccall("wcall_set_audio_files", "number", ["number", "string", "string"], [wuser, play_path, record_path]);
607
616
  };
608
617
  Wcall.prototype.poll = function () {
609
618
  this.em_module.ccall("wcall_poll", "null", [], []);
package/package.json CHANGED
@@ -27,5 +27,5 @@
27
27
  "prepack": "prettier -w src/avs_wcall.ts && tsc && cp src/*.js src/*.d.ts dist/",
28
28
  "test": "karma start"
29
29
  },
30
- "version": "10.5.43"
30
+ "version": "10.6.2"
31
31
  }