@wireapp/avs 10.5.48 → 10.5.49
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_core.js +1 -1
- package/dist/avs_pc.js +50 -25
- package/package.json +1 -1
package/dist/avs_pc.js
CHANGED
|
@@ -1400,6 +1400,7 @@ function pc_InitModule(module, logh) {
|
|
|
1400
1400
|
[pc_DataChannelClose, "vi"],
|
|
1401
1401
|
[pc_SetMediaKey, "viiiii"],
|
|
1402
1402
|
[pc_UpdateSsrc, "viii"],
|
|
1403
|
+
[pc_GetAudioLevels, "vi"],
|
|
1403
1404
|
].map(function (_a) {
|
|
1404
1405
|
var callback = _a[0], signature = _a[1];
|
|
1405
1406
|
return em_module.addFunction(callback, signature);
|
|
@@ -1444,8 +1445,20 @@ function pc_GetStats(convid) {
|
|
|
1444
1445
|
}
|
|
1445
1446
|
return Promise.all(statsPromises);
|
|
1446
1447
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1448
|
+
/* Sources linger in getSynchronizationSources() for up to 10 s after
|
|
1449
|
+
* their last packet (e.g. no longer forwarded by the SFT), ignore those.
|
|
1450
|
+
*/
|
|
1451
|
+
var AULEVEL_SOURCE_MAX_AGE = 500;
|
|
1452
|
+
/* Browsers differ in the time base of RTCRtpContributingSource.timestamp:
|
|
1453
|
+
* some use the performance timeline, others the wall clock.
|
|
1454
|
+
*/
|
|
1455
|
+
function source_age(timestamp) {
|
|
1456
|
+
if (timestamp > 1e12)
|
|
1457
|
+
return Date.now() - timestamp;
|
|
1458
|
+
else
|
|
1459
|
+
return performance.now() - timestamp;
|
|
1460
|
+
}
|
|
1461
|
+
function pc_GetAudioLevels(hnd) {
|
|
1449
1462
|
var pc = connectionsStore.getPeerConnection(hnd);
|
|
1450
1463
|
if (pc == null) {
|
|
1451
1464
|
return;
|
|
@@ -1457,34 +1470,46 @@ function pc_GetLocalStats(hnd) {
|
|
|
1457
1470
|
var txrxs = rtc.getTransceivers();
|
|
1458
1471
|
txrxs.forEach(function (txrx) {
|
|
1459
1472
|
var rx = txrx.receiver;
|
|
1460
|
-
if (rx)
|
|
1473
|
+
if (!rx || !rx.track || rx.track.kind !== 'audio')
|
|
1474
|
+
return;
|
|
1475
|
+
/* The SFT forwards on its own SSRCs and puts the sender's
|
|
1476
|
+
* SSRC in the CSRC list, P2P packets carry no CSRCs.
|
|
1477
|
+
*/
|
|
1478
|
+
if (pc.conv_type == CONV_TYPE_ONEONONE) {
|
|
1461
1479
|
var ssrcs = rx.getSynchronizationSources();
|
|
1462
1480
|
ssrcs.forEach(function (ssrc) {
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
if (
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
var uinfo = uinfo_from_ssrca(pc, ssrc.source.toString());
|
|
1469
|
-
if (uinfo) {
|
|
1470
|
-
uinfo.audio_level = aulevel;
|
|
1471
|
-
ssrca = uinfo.ssrca;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
em_module.ccall("pc_set_audio_level", null, ["number", "number", "number"], [pc.self, ssrca, aulevel]);
|
|
1475
|
-
});
|
|
1476
|
-
var csrcs = rx.getContributingSources();
|
|
1477
|
-
csrcs.forEach(function (csrc) {
|
|
1478
|
-
var uinfo = uinfo_from_ssrca(pc, csrc.source.toString());
|
|
1479
|
-
if (uinfo) {
|
|
1480
|
-
uinfo.audio_level = 0;
|
|
1481
|
-
if (typeof csrc.audioLevel !== 'undefined')
|
|
1482
|
-
uinfo.audio_level = ((csrc.audioLevel * 512.0) | 0);
|
|
1483
|
-
em_module.ccall("pc_set_audio_level", null, ["number", "number", "number"], [pc.self, uinfo.ssrca, uinfo.audio_level]);
|
|
1484
|
-
}
|
|
1481
|
+
if (typeof ssrc.audioLevel === 'undefined')
|
|
1482
|
+
return;
|
|
1483
|
+
if (source_age(ssrc.timestamp) > AULEVEL_SOURCE_MAX_AGE)
|
|
1484
|
+
return;
|
|
1485
|
+
em_module.ccall("pc_set_audio_level", null, ["number", "number", "number"], [pc.self, 0, (ssrc.audioLevel * 512.0) | 0]);
|
|
1485
1486
|
});
|
|
1487
|
+
return;
|
|
1486
1488
|
}
|
|
1489
|
+
var csrcs = rx.getContributingSources();
|
|
1490
|
+
csrcs.forEach(function (csrc) {
|
|
1491
|
+
if (typeof csrc.audioLevel === 'undefined')
|
|
1492
|
+
return;
|
|
1493
|
+
if (source_age(csrc.timestamp) > AULEVEL_SOURCE_MAX_AGE)
|
|
1494
|
+
return;
|
|
1495
|
+
var uinfo = uinfo_from_ssrca(pc, csrc.source.toString());
|
|
1496
|
+
if (!uinfo)
|
|
1497
|
+
return;
|
|
1498
|
+
uinfo.audio_level = ((csrc.audioLevel * 512.0) | 0);
|
|
1499
|
+
em_module.ccall("pc_set_audio_level", null, ["number", "number", "number"], [pc.self, uinfo.ssrca, uinfo.audio_level]);
|
|
1500
|
+
});
|
|
1487
1501
|
});
|
|
1502
|
+
}
|
|
1503
|
+
function pc_GetLocalStats(hnd) {
|
|
1504
|
+
pc_log(LOG_LEVEL_INFO, "pc_GetLocalStats: hnd=".concat(hnd));
|
|
1505
|
+
var pc = connectionsStore.getPeerConnection(hnd);
|
|
1506
|
+
if (pc == null) {
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
var rtc = pc.rtc;
|
|
1510
|
+
if (!rtc) {
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1488
1513
|
rtc.getStats()
|
|
1489
1514
|
.then(function (stats) {
|
|
1490
1515
|
// !This does not work --> let report_json = JSON.stringify(stats);
|
package/package.json
CHANGED