@volcengine/veplayer-plugin 2.8.0-rc.2 → 2.8.1-rc.0
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/esm/index.development.js +77346 -35689
- package/esm/index.production.js +8 -7
- package/esm/veplayer.plugin.ad.development.js +1412 -1398
- package/esm/veplayer.plugin.ad.production.js +2 -2
- package/esm/veplayer.plugin.drm.development.js +147 -63
- package/esm/veplayer.plugin.drm.production.js +1 -1
- package/esm/veplayer.plugin.hlsjs.development.js +32501 -10992
- package/esm/veplayer.plugin.hlsjs.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +417 -127
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.ad.development.js +1412 -1398
- package/umd/veplayer.plugin.ad.production.js +1 -1
- package/umd/veplayer.plugin.drm.development.js +148 -64
- package/umd/veplayer.plugin.drm.production.js +1 -1
- package/umd/veplayer.plugin.hlsjs.development.js +32478 -10969
- package/umd/veplayer.plugin.hlsjs.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +417 -127
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -478,6 +478,38 @@
|
|
|
478
478
|
return false;
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
482
|
+
if (source == null)
|
|
483
|
+
return {};
|
|
484
|
+
var target = {};
|
|
485
|
+
var sourceKeys = Object.keys(source);
|
|
486
|
+
var key, i;
|
|
487
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
488
|
+
key = sourceKeys[i];
|
|
489
|
+
if (excluded.indexOf(key) >= 0)
|
|
490
|
+
continue;
|
|
491
|
+
target[key] = source[key];
|
|
492
|
+
}
|
|
493
|
+
return target;
|
|
494
|
+
}
|
|
495
|
+
function _objectWithoutProperties$1(source, excluded) {
|
|
496
|
+
if (source == null)
|
|
497
|
+
return {};
|
|
498
|
+
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
499
|
+
var key, i;
|
|
500
|
+
if (Object.getOwnPropertySymbols) {
|
|
501
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
502
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
503
|
+
key = sourceSymbolKeys[i];
|
|
504
|
+
if (excluded.indexOf(key) >= 0)
|
|
505
|
+
continue;
|
|
506
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
507
|
+
continue;
|
|
508
|
+
target[key] = source[key];
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return target;
|
|
512
|
+
}
|
|
481
513
|
function _assertThisInitialized$1(self2) {
|
|
482
514
|
if (self2 === void 0) {
|
|
483
515
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -4011,7 +4043,7 @@
|
|
|
4011
4043
|
}]);
|
|
4012
4044
|
return XhrLoader2;
|
|
4013
4045
|
}(EventEmitter);
|
|
4014
|
-
var _excluded = ["retry", "retryDelay", "onRetryError", "transformError"];
|
|
4046
|
+
var _excluded$1 = ["retry", "retryDelay", "onRetryError", "transformError"];
|
|
4015
4047
|
var Task = /* @__PURE__ */ function() {
|
|
4016
4048
|
function Task2(type, config) {
|
|
4017
4049
|
_classCallCheck$1(this, Task2);
|
|
@@ -4031,7 +4063,7 @@
|
|
|
4031
4063
|
key: "exec",
|
|
4032
4064
|
value: function exec() {
|
|
4033
4065
|
var _this = this;
|
|
4034
|
-
var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties(_this$_config, _excluded);
|
|
4066
|
+
var _this$_config = this._config, retry = _this$_config.retry, retryDelay = _this$_config.retryDelay, onRetryError = _this$_config.onRetryError, transformError = _this$_config.transformError, rest = _objectWithoutProperties(_this$_config, _excluded$1);
|
|
4035
4067
|
var request = /* @__PURE__ */ function() {
|
|
4036
4068
|
var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
|
|
4037
4069
|
var response, error, isRetry;
|
|
@@ -4947,7 +4979,9 @@
|
|
|
4947
4979
|
lib.parseRemoteCandidates = parser.parseRemoteCandidates;
|
|
4948
4980
|
lib.parseImageAttributes = parser.parseImageAttributes;
|
|
4949
4981
|
lib.parseSimulcastStreamList = parser.parseSimulcastStreamList;
|
|
4950
|
-
|
|
4982
|
+
var _excluded = ["adaptiveJitterBuffer"];
|
|
4983
|
+
function getOption(options) {
|
|
4984
|
+
var _ref = options || {}, _ref$adaptiveJitterBu = _ref.adaptiveJitterBuffer, adaptiveJitterBuffer = _ref$adaptiveJitterBu === void 0 ? {} : _ref$adaptiveJitterBu, opts = _objectWithoutProperties$1(_ref, _excluded);
|
|
4951
4985
|
return _objectSpread2$2({
|
|
4952
4986
|
retryCount: 0,
|
|
4953
4987
|
retryDelay: 1e3,
|
|
@@ -4955,11 +4989,15 @@
|
|
|
4955
4989
|
stallInterval: 400,
|
|
4956
4990
|
networkEvaluateInterval: 1e3,
|
|
4957
4991
|
delayHint: 0,
|
|
4992
|
+
videoDelaySync: false,
|
|
4958
4993
|
seamlesslyReload: false,
|
|
4959
4994
|
enableSei: false,
|
|
4960
4995
|
enableOriginSdpLogger: false,
|
|
4961
4996
|
checkStatsErrorDelay: 5e3,
|
|
4997
|
+
connectionStateChangeTimeout: 5e3,
|
|
4962
4998
|
enableNetworkQuality: false,
|
|
4999
|
+
hackCreateOfferIssue: false,
|
|
5000
|
+
progressiveSetDelay: false,
|
|
4963
5001
|
networkQuality: {
|
|
4964
5002
|
networkQos: {
|
|
4965
5003
|
1: {
|
|
@@ -4990,9 +5028,14 @@
|
|
|
4990
5028
|
}
|
|
4991
5029
|
},
|
|
4992
5030
|
enableAdaptiveJitterBuffer: false,
|
|
4993
|
-
adaptiveJitterBuffer: {
|
|
4994
|
-
networkWindow: 3
|
|
4995
|
-
|
|
5031
|
+
adaptiveJitterBuffer: _objectSpread2$2({
|
|
5032
|
+
networkWindow: 3,
|
|
5033
|
+
windowMethod: "max",
|
|
5034
|
+
loopInterval: 500,
|
|
5035
|
+
maxAvSyncDelay: 400,
|
|
5036
|
+
maxJitterBufferDiff: 500,
|
|
5037
|
+
maxStep: 500
|
|
5038
|
+
}, adaptiveJitterBuffer),
|
|
4996
5039
|
networkStrategy: {
|
|
4997
5040
|
1: {
|
|
4998
5041
|
"jitterBuffer": null
|
|
@@ -6441,6 +6484,12 @@
|
|
|
6441
6484
|
if (stat.fecPacketsReceived !== void 0) {
|
|
6442
6485
|
currentStats.fecPacketsReceived = stat.fecPacketsReceived;
|
|
6443
6486
|
}
|
|
6487
|
+
if (stat.estimatedPlayoutTimestamp !== void 0) {
|
|
6488
|
+
currentStats.estimatedPlayoutTimestamp = stat.estimatedPlayoutTimestamp;
|
|
6489
|
+
}
|
|
6490
|
+
if (stat.totalSamplesDuration !== void 0) {
|
|
6491
|
+
currentStats.totalSamplesDuration = stat.totalSamplesDuration;
|
|
6492
|
+
}
|
|
6444
6493
|
} else if (stat.type === "codec") {
|
|
6445
6494
|
currentStats.recordSampleRate = stat.clockRate;
|
|
6446
6495
|
if (stat.channels) {
|
|
@@ -6468,13 +6517,17 @@
|
|
|
6468
6517
|
var statsInterval = diffNumber(oldStats, newStats, "timestamp");
|
|
6469
6518
|
var packetsLostDiff = diffNumber(oldStats, newStats, "packetsLost");
|
|
6470
6519
|
var jitterBufferDelay = Math.round(diffNumber(oldStats, newStats, "jitterBufferDelay") / diffNumber(oldStats, newStats, "jitterBufferEmittedCount") * 1e3);
|
|
6520
|
+
var packetsReceived = diffNumber(oldStats, newStats, "packetsReceived");
|
|
6471
6521
|
return {
|
|
6472
|
-
audioLossRate: +(packetsLostDiff / (
|
|
6522
|
+
audioLossRate: +(packetsLostDiff / (packetsReceived + packetsLostDiff)).toFixed(2),
|
|
6473
6523
|
receivedKBitrate: +(diffNumber(oldStats, newStats, "bytesReceived") * 8 / statsInterval).toFixed(2),
|
|
6474
6524
|
statsInterval,
|
|
6475
6525
|
rtt: newStats.rtt || 0,
|
|
6476
6526
|
jitterBufferDelay,
|
|
6527
|
+
packetsReceived,
|
|
6477
6528
|
numChannels: newStats.numChannels || 1,
|
|
6529
|
+
estimatedPlayoutTimestamp: newStats.estimatedPlayoutTimestamp,
|
|
6530
|
+
samplesDuration: Math.round(diffNumber(oldStats, newStats, "totalSamplesDuration") * 1e3),
|
|
6478
6531
|
receivedSampleRate: diffNumber(oldStats, newStats, "totalSamplesReceived") / statsInterval,
|
|
6479
6532
|
concealedSamples: Math.round(diffNumber(oldStats, newStats, "concealedSamples")),
|
|
6480
6533
|
concealmentEvent: Math.round(diffNumber(oldStats, newStats, "concealmentEvents")),
|
|
@@ -6518,6 +6571,9 @@
|
|
|
6518
6571
|
currentStats.width = stat.frameWidth;
|
|
6519
6572
|
currentStats.height = stat.frameHeight;
|
|
6520
6573
|
}
|
|
6574
|
+
if (stat.estimatedPlayoutTimestamp !== void 0) {
|
|
6575
|
+
currentStats.estimatedPlayoutTimestamp = stat.estimatedPlayoutTimestamp;
|
|
6576
|
+
}
|
|
6521
6577
|
} else if (stat.type === "track" && stat.frameWidth !== void 0) {
|
|
6522
6578
|
currentStats.width = stat.frameWidth;
|
|
6523
6579
|
currentStats.height = stat.frameHeight;
|
|
@@ -6550,6 +6606,7 @@
|
|
|
6550
6606
|
statsInterval,
|
|
6551
6607
|
width: newStats.width || 0,
|
|
6552
6608
|
height: newStats.height || 0,
|
|
6609
|
+
estimatedPlayoutTimestamp: newStats.estimatedPlayoutTimestamp,
|
|
6553
6610
|
videoLossRate: +(packetsLostDiff / (diffNumber(oldStats, newStats, "packetsReceived") + packetsLostDiff)),
|
|
6554
6611
|
receivedKBitrate: +(diffNumber(oldStats, newStats, "bytesReceived") * 8 / statsInterval).toFixed(2),
|
|
6555
6612
|
decoderOutputFrameRate: Math.round(diffNumber(oldStats, newStats, "framesDecoded") * 1e3 / statsInterval),
|
|
@@ -6732,11 +6789,15 @@
|
|
|
6732
6789
|
_defineProperty$2(_assertThisInitialized$1(_this), "_preVideoStats", null);
|
|
6733
6790
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtcReportTimer", 0);
|
|
6734
6791
|
_defineProperty$2(_assertThisInitialized$1(_this), "_networkQualityResult", []);
|
|
6792
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_peerStateTimer", null);
|
|
6735
6793
|
_defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
6736
6794
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
6737
6795
|
while (1)
|
|
6738
6796
|
switch (_context2.prev = _context2.next) {
|
|
6739
6797
|
case 0:
|
|
6798
|
+
if (_this._checkStatsErrorTimer) {
|
|
6799
|
+
clearTimeout(_this._checkStatsErrorTimer);
|
|
6800
|
+
}
|
|
6740
6801
|
_this._checkStatsErrorTimer = setTimeout(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
|
|
6741
6802
|
var stats, _stats$video, framesDecoded, bytesReceived;
|
|
6742
6803
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
@@ -6765,7 +6826,7 @@
|
|
|
6765
6826
|
}
|
|
6766
6827
|
}, _callee);
|
|
6767
6828
|
})), _this._opts.checkStatsErrorDelay);
|
|
6768
|
-
case
|
|
6829
|
+
case 2:
|
|
6769
6830
|
case "end":
|
|
6770
6831
|
return _context2.stop();
|
|
6771
6832
|
}
|
|
@@ -6803,28 +6864,165 @@
|
|
|
6803
6864
|
});
|
|
6804
6865
|
});
|
|
6805
6866
|
_defineProperty$2(_assertThisInitialized$1(_this), "_setDelay", function(delayHint) {
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
try {
|
|
6811
|
-
var videoReceiver = _this._videoTransceicer.receiver;
|
|
6812
|
-
var audioReceiver = _this._audioTransceicer.receiver;
|
|
6867
|
+
if (_this._opts.progressiveSetDelay) {
|
|
6868
|
+
_this._startSetDelayLoop(delayHint);
|
|
6869
|
+
} else {
|
|
6870
|
+
var _this$_audioTransceic2;
|
|
6813
6871
|
var key = [
|
|
6814
6872
|
"playoutDelayHint",
|
|
6815
6873
|
"jitterBufferDelayHint",
|
|
6816
6874
|
"jitterBufferTarget"
|
|
6817
6875
|
].find(function(key2) {
|
|
6818
|
-
|
|
6876
|
+
var _this$_audioTransceic, _this$_videoTransceic;
|
|
6877
|
+
return key2 in ((_this$_audioTransceic = _this._audioTransceicer) === null || _this$_audioTransceic === void 0 ? void 0 : _this$_audioTransceic.receiver) && key2 in ((_this$_videoTransceic = _this._videoTransceicer) === null || _this$_videoTransceic === void 0 ? void 0 : _this$_videoTransceic.receiver);
|
|
6819
6878
|
});
|
|
6820
|
-
if (key)
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6879
|
+
if (!key)
|
|
6880
|
+
return;
|
|
6881
|
+
delayHint = typeof delayHint === "number" && delayHint > 0 ? delayHint : null;
|
|
6882
|
+
if (((_this$_audioTransceic2 = _this._audioTransceicer) === null || _this$_audioTransceic2 === void 0 ? void 0 : _this$_audioTransceic2.receiver[key]) === delayHint)
|
|
6883
|
+
return;
|
|
6884
|
+
_this._audioTransceicer.receiver[key] = delayHint;
|
|
6885
|
+
_this._videoTransceicer.receiver[key] = delayHint;
|
|
6826
6886
|
}
|
|
6827
6887
|
});
|
|
6888
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_targetDelayHint", null);
|
|
6889
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_setDelayTimer", null);
|
|
6890
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_setDelayError", null);
|
|
6891
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_startSetDelayLoop", /* @__PURE__ */ function() {
|
|
6892
|
+
var _ref3 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee4(delayHint) {
|
|
6893
|
+
var key, preAudioStats, preVideoStats, _this$_opts$adaptiveJ, loopInterval, maxAvSyncDelay, maxJitterBufferDiff, maxStep, avDiffTooMuchCount;
|
|
6894
|
+
return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
|
|
6895
|
+
while (1)
|
|
6896
|
+
switch (_context4.prev = _context4.next) {
|
|
6897
|
+
case 0:
|
|
6898
|
+
key = [
|
|
6899
|
+
"playoutDelayHint",
|
|
6900
|
+
"jitterBufferDelayHint",
|
|
6901
|
+
"jitterBufferTarget"
|
|
6902
|
+
].find(function(key2) {
|
|
6903
|
+
var _this$_audioTransceic3, _this$_videoTransceic2;
|
|
6904
|
+
return key2 in ((_this$_audioTransceic3 = _this._audioTransceicer) === null || _this$_audioTransceic3 === void 0 ? void 0 : _this$_audioTransceic3.receiver) && key2 in ((_this$_videoTransceic2 = _this._videoTransceicer) === null || _this$_videoTransceic2 === void 0 ? void 0 : _this$_videoTransceic2.receiver);
|
|
6905
|
+
});
|
|
6906
|
+
if (key) {
|
|
6907
|
+
_context4.next = 3;
|
|
6908
|
+
break;
|
|
6909
|
+
}
|
|
6910
|
+
return _context4.abrupt("return");
|
|
6911
|
+
case 3:
|
|
6912
|
+
delayHint = typeof delayHint === "number" && delayHint > 0 ? delayHint : null;
|
|
6913
|
+
if (!(_this._targetDelayHint === delayHint)) {
|
|
6914
|
+
_context4.next = 6;
|
|
6915
|
+
break;
|
|
6916
|
+
}
|
|
6917
|
+
return _context4.abrupt("return");
|
|
6918
|
+
case 6:
|
|
6919
|
+
_this._targetDelayHint = delayHint;
|
|
6920
|
+
if (!_this._setDelayTimer) {
|
|
6921
|
+
_context4.next = 9;
|
|
6922
|
+
break;
|
|
6923
|
+
}
|
|
6924
|
+
return _context4.abrupt("return");
|
|
6925
|
+
case 9:
|
|
6926
|
+
preAudioStats = null;
|
|
6927
|
+
preVideoStats = null;
|
|
6928
|
+
_this$_opts$adaptiveJ = _this._opts.adaptiveJitterBuffer, loopInterval = _this$_opts$adaptiveJ.loopInterval, maxAvSyncDelay = _this$_opts$adaptiveJ.maxAvSyncDelay, maxJitterBufferDiff = _this$_opts$adaptiveJ.maxJitterBufferDiff, maxStep = _this$_opts$adaptiveJ.maxStep;
|
|
6929
|
+
avDiffTooMuchCount = 0;
|
|
6930
|
+
_this._setDelayTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3() {
|
|
6931
|
+
var _this$_audioTransceic4, _this$_videoTransceic3, currentTargetDelay, targetDelayMs, currentTargetDelayMs, _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats, audioStats, videoStats, av_sync_diff, currentAudioDelay, currentVideoDelay, addOrReduce, nextJitterBufferDelay;
|
|
6932
|
+
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
6933
|
+
while (1)
|
|
6934
|
+
switch (_context3.prev = _context3.next) {
|
|
6935
|
+
case 0:
|
|
6936
|
+
_context3.prev = 0;
|
|
6937
|
+
if (!(!((_this$_audioTransceic4 = _this._audioTransceicer) !== null && _this$_audioTransceic4 !== void 0 && _this$_audioTransceic4.receiver) || !((_this$_videoTransceic3 = _this._videoTransceicer) !== null && _this$_videoTransceic3 !== void 0 && _this$_videoTransceic3.receiver))) {
|
|
6938
|
+
_context3.next = 5;
|
|
6939
|
+
break;
|
|
6940
|
+
}
|
|
6941
|
+
preAudioStats = null;
|
|
6942
|
+
preVideoStats = null;
|
|
6943
|
+
return _context3.abrupt("return");
|
|
6944
|
+
case 5:
|
|
6945
|
+
currentTargetDelay = _this._audioTransceicer.receiver[key];
|
|
6946
|
+
if (!(currentTargetDelay === _this._targetDelayHint)) {
|
|
6947
|
+
_context3.next = 8;
|
|
6948
|
+
break;
|
|
6949
|
+
}
|
|
6950
|
+
return _context3.abrupt("return");
|
|
6951
|
+
case 8:
|
|
6952
|
+
targetDelayMs = _this._targetDelayHint * 1e3;
|
|
6953
|
+
currentTargetDelayMs = currentTargetDelay * 1e3;
|
|
6954
|
+
_context3.next = 12;
|
|
6955
|
+
return Promise.all([getRecvAudioStats(_this._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this._videoTransceicer.receiver.getStats())]);
|
|
6956
|
+
case 12:
|
|
6957
|
+
_yield$Promise$all = _context3.sent;
|
|
6958
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
6959
|
+
curAudioStats = _yield$Promise$all2[0];
|
|
6960
|
+
curVideoStats = _yield$Promise$all2[1];
|
|
6961
|
+
if (!(preAudioStats && preVideoStats)) {
|
|
6962
|
+
_context3.next = 36;
|
|
6963
|
+
break;
|
|
6964
|
+
}
|
|
6965
|
+
audioStats = diffRecvAudioStats(preAudioStats, curAudioStats);
|
|
6966
|
+
videoStats = diffRecvVideoStats(preVideoStats, curVideoStats);
|
|
6967
|
+
if (videoStats.estimatedPlayoutTimestamp && audioStats.estimatedPlayoutTimestamp) {
|
|
6968
|
+
av_sync_diff = videoStats.estimatedPlayoutTimestamp - audioStats.estimatedPlayoutTimestamp;
|
|
6969
|
+
}
|
|
6970
|
+
currentAudioDelay = audioStats.jitterBufferDelay;
|
|
6971
|
+
currentVideoDelay = videoStats.jitterBufferDelay;
|
|
6972
|
+
if (!(currentAudioDelay && currentVideoDelay)) {
|
|
6973
|
+
_context3.next = 36;
|
|
6974
|
+
break;
|
|
6975
|
+
}
|
|
6976
|
+
if (!(Math.abs(currentAudioDelay - currentVideoDelay) > maxAvSyncDelay || av_sync_diff && Math.abs(av_sync_diff) > maxAvSyncDelay)) {
|
|
6977
|
+
_context3.next = 27;
|
|
6978
|
+
break;
|
|
6979
|
+
}
|
|
6980
|
+
if (avDiffTooMuchCount++ > 8 && currentVideoDelay > currentAudioDelay) {
|
|
6981
|
+
_this._audioTransceicer.receiver[key] = Math.min(currentVideoDelay / 1e3, _this._targetDelayHint);
|
|
6982
|
+
avDiffTooMuchCount = 0;
|
|
6983
|
+
}
|
|
6984
|
+
logger.log("av_jb_diff(".concat(currentAudioDelay - currentVideoDelay, "=").concat(currentAudioDelay, "-").concat(currentVideoDelay, ") or av_sync_diff(").concat(av_sync_diff, ") too much, skip setting"));
|
|
6985
|
+
return _context3.abrupt("return");
|
|
6986
|
+
case 27:
|
|
6987
|
+
avDiffTooMuchCount = 0;
|
|
6988
|
+
if (!(currentTargetDelay !== null && (Math.abs(currentAudioDelay - currentTargetDelayMs) > maxJitterBufferDiff || Math.abs(currentVideoDelay - currentTargetDelayMs) > maxJitterBufferDiff))) {
|
|
6989
|
+
_context3.next = 31;
|
|
6990
|
+
break;
|
|
6991
|
+
}
|
|
6992
|
+
logger.log("audio(".concat(currentAudioDelay - currentTargetDelayMs, "),video(").concat(currentVideoDelay - currentTargetDelayMs, "). current_target_diff too much, skip setting"));
|
|
6993
|
+
return _context3.abrupt("return");
|
|
6994
|
+
case 31:
|
|
6995
|
+
addOrReduce = targetDelayMs > (currentTargetDelayMs || currentAudioDelay) ? 1 : -1;
|
|
6996
|
+
nextJitterBufferDelay = (Math.abs(targetDelayMs - (currentTargetDelayMs || currentAudioDelay)) > maxStep ? (currentTargetDelayMs || currentAudioDelay) + addOrReduce * maxStep : targetDelayMs) / 1e3;
|
|
6997
|
+
nextJitterBufferDelay = nextJitterBufferDelay > 0.2 ? nextJitterBufferDelay : null;
|
|
6998
|
+
logger.log("set receiver.".concat(key, " = ").concat(nextJitterBufferDelay));
|
|
6999
|
+
_this._audioTransceicer.receiver[key] = nextJitterBufferDelay;
|
|
7000
|
+
case 36:
|
|
7001
|
+
preAudioStats = curAudioStats;
|
|
7002
|
+
preVideoStats = curVideoStats;
|
|
7003
|
+
_context3.next = 44;
|
|
7004
|
+
break;
|
|
7005
|
+
case 40:
|
|
7006
|
+
_context3.prev = 40;
|
|
7007
|
+
_context3.t0 = _context3["catch"](0);
|
|
7008
|
+
logger.error("set delay loop error:", _context3.t0);
|
|
7009
|
+
_this._setDelayError = _context3.t0.message || _context3.t0.toString() || "unknown error";
|
|
7010
|
+
case 44:
|
|
7011
|
+
case "end":
|
|
7012
|
+
return _context3.stop();
|
|
7013
|
+
}
|
|
7014
|
+
}, _callee3, null, [[0, 40]]);
|
|
7015
|
+
})), loopInterval);
|
|
7016
|
+
case 14:
|
|
7017
|
+
case "end":
|
|
7018
|
+
return _context4.stop();
|
|
7019
|
+
}
|
|
7020
|
+
}, _callee4);
|
|
7021
|
+
}));
|
|
7022
|
+
return function(_x) {
|
|
7023
|
+
return _ref3.apply(this, arguments);
|
|
7024
|
+
};
|
|
7025
|
+
}());
|
|
6828
7026
|
_defineProperty$2(_assertThisInitialized$1(_this), "_getDelay", function() {
|
|
6829
7027
|
try {
|
|
6830
7028
|
var key = ["playoutDelayHint", "jitterBufferDelayHint", "jitterBufferTarget"].find(function(key2) {
|
|
@@ -6900,44 +7098,51 @@
|
|
|
6900
7098
|
}, {
|
|
6901
7099
|
key: "load",
|
|
6902
7100
|
value: function() {
|
|
6903
|
-
var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
7101
|
+
var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(url) {
|
|
6904
7102
|
var _this2 = this;
|
|
6905
|
-
var
|
|
6906
|
-
return _regeneratorRuntime$1().wrap(function
|
|
7103
|
+
var encodedTransformSupported, lastPc;
|
|
7104
|
+
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
6907
7105
|
while (1)
|
|
6908
|
-
switch (
|
|
7106
|
+
switch (_context5.prev = _context5.next) {
|
|
6909
7107
|
case 0:
|
|
6910
7108
|
this._disconnect();
|
|
6911
7109
|
this._url = url;
|
|
6912
7110
|
this._retry = this._opts.retryCount;
|
|
7111
|
+
if (!this._opts.hackCreateOfferIssue) {
|
|
7112
|
+
_context5.next = 6;
|
|
7113
|
+
break;
|
|
7114
|
+
}
|
|
7115
|
+
_context5.next = 6;
|
|
7116
|
+
return this._createEmptyPeer();
|
|
7117
|
+
case 6:
|
|
7118
|
+
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
7119
|
+
_context5.prev = 7;
|
|
6913
7120
|
lastPc = this._pc;
|
|
6914
7121
|
if (lastPc) {
|
|
6915
7122
|
lastPc.close();
|
|
6916
7123
|
}
|
|
6917
|
-
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
6918
|
-
_context3.prev = 6;
|
|
6919
7124
|
this._pc = new RTCPeerConnection({
|
|
6920
7125
|
encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
|
|
6921
7126
|
});
|
|
6922
7127
|
this._bindRTCEvents();
|
|
6923
|
-
|
|
7128
|
+
_context5.next = 14;
|
|
6924
7129
|
return this._connect(url);
|
|
6925
|
-
case
|
|
6926
|
-
|
|
7130
|
+
case 14:
|
|
7131
|
+
_context5.next = 19;
|
|
6927
7132
|
break;
|
|
6928
|
-
case
|
|
6929
|
-
|
|
6930
|
-
|
|
7133
|
+
case 16:
|
|
7134
|
+
_context5.prev = 16;
|
|
7135
|
+
_context5.t0 = _context5["catch"](7);
|
|
6931
7136
|
setTimeout(function() {
|
|
6932
|
-
return _this2._emitError(StreamingError.create(ERR.OTHER, null,
|
|
7137
|
+
return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context5.t0));
|
|
6933
7138
|
});
|
|
6934
|
-
case
|
|
7139
|
+
case 19:
|
|
6935
7140
|
case "end":
|
|
6936
|
-
return
|
|
7141
|
+
return _context5.stop();
|
|
6937
7142
|
}
|
|
6938
|
-
},
|
|
7143
|
+
}, _callee5, this, [[7, 16]]);
|
|
6939
7144
|
}));
|
|
6940
|
-
function load(
|
|
7145
|
+
function load(_x2) {
|
|
6941
7146
|
return _load.apply(this, arguments);
|
|
6942
7147
|
}
|
|
6943
7148
|
return load;
|
|
@@ -6955,6 +7160,7 @@
|
|
|
6955
7160
|
pc.addEventListener("track", this._onTrack);
|
|
6956
7161
|
pc.addEventListener("connectionstatechange", function() {
|
|
6957
7162
|
logger.warn("onconnectionstatechange:", pc.connectionState);
|
|
7163
|
+
_this3._clearPeerStateTimeout();
|
|
6958
7164
|
_this3.emit(EXTEND_EVENTS.RTC_STATE_CHANGE, {
|
|
6959
7165
|
state: pc.connectionState,
|
|
6960
7166
|
url: _this3._url
|
|
@@ -7074,15 +7280,15 @@
|
|
|
7074
7280
|
}, {
|
|
7075
7281
|
key: "_connect",
|
|
7076
7282
|
value: function() {
|
|
7077
|
-
var _connect2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
7283
|
+
var _connect2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6() {
|
|
7078
7284
|
var pc, offer, parsed, finnalUrl, _this$_opts, _answer$remoteSdp, _this$_opts2, _answer$remoteSdp2, _parsed$media, parseSession, sessionId, reqStart, res, answer, err, _parsed;
|
|
7079
|
-
return _regeneratorRuntime$1().wrap(function
|
|
7285
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
7080
7286
|
while (1)
|
|
7081
|
-
switch (
|
|
7287
|
+
switch (_context6.prev = _context6.next) {
|
|
7082
7288
|
case 0:
|
|
7083
7289
|
pc = this._pc;
|
|
7084
7290
|
if (!pc.addTransceiver) {
|
|
7085
|
-
|
|
7291
|
+
_context6.next = 11;
|
|
7086
7292
|
break;
|
|
7087
7293
|
}
|
|
7088
7294
|
this._audioTransceicer = pc.addTransceiver("audio", {
|
|
@@ -7091,27 +7297,30 @@
|
|
|
7091
7297
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
7092
7298
|
direction: "recvonly"
|
|
7093
7299
|
});
|
|
7094
|
-
|
|
7300
|
+
this._setDelay(this._opts.delayHint);
|
|
7095
7301
|
if (this._opts.enableSei) {
|
|
7096
7302
|
this.initVideoEncodedTransform();
|
|
7097
7303
|
this.initAudioEncodedTransform();
|
|
7098
7304
|
}
|
|
7099
|
-
|
|
7305
|
+
_context6.next = 8;
|
|
7100
7306
|
return pc.createOffer();
|
|
7101
7307
|
case 8:
|
|
7102
|
-
offer =
|
|
7103
|
-
|
|
7308
|
+
offer = _context6.sent;
|
|
7309
|
+
_context6.next = 14;
|
|
7104
7310
|
break;
|
|
7105
7311
|
case 11:
|
|
7106
|
-
|
|
7312
|
+
_context6.next = 13;
|
|
7107
7313
|
return pc.createOffer({
|
|
7108
7314
|
iceRestart: true,
|
|
7109
7315
|
offerToReceiveAudio: true,
|
|
7110
7316
|
offerToReceiveVideo: true
|
|
7111
7317
|
});
|
|
7112
7318
|
case 13:
|
|
7113
|
-
offer =
|
|
7319
|
+
offer = _context6.sent;
|
|
7114
7320
|
case 14:
|
|
7321
|
+
if (this._opts.hackCreateOfferIssue) {
|
|
7322
|
+
this._createEmptyPeer();
|
|
7323
|
+
}
|
|
7115
7324
|
logger.log("local offer");
|
|
7116
7325
|
logger.log(offer.sdp);
|
|
7117
7326
|
parsed = lib.parse(offer.sdp);
|
|
@@ -7136,11 +7345,11 @@
|
|
|
7136
7345
|
});
|
|
7137
7346
|
offer.sdp = lib.write(parsed);
|
|
7138
7347
|
logger.log("local offer modified:\n", offer.sdp);
|
|
7139
|
-
|
|
7348
|
+
_context6.next = 23;
|
|
7140
7349
|
return pc.setLocalDescription(offer);
|
|
7141
|
-
case
|
|
7350
|
+
case 23:
|
|
7142
7351
|
finnalUrl = this._url;
|
|
7143
|
-
|
|
7352
|
+
_context6.prev = 24;
|
|
7144
7353
|
if (this._opts.preProcessUrl) {
|
|
7145
7354
|
finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
|
|
7146
7355
|
}
|
|
@@ -7153,7 +7362,7 @@
|
|
|
7153
7362
|
sessionId
|
|
7154
7363
|
});
|
|
7155
7364
|
reqStart = Date.now();
|
|
7156
|
-
|
|
7365
|
+
_context6.next = 33;
|
|
7157
7366
|
return this._loader.load(finnalUrl, {
|
|
7158
7367
|
body: JSON.stringify({
|
|
7159
7368
|
sessionId,
|
|
@@ -7161,27 +7370,27 @@
|
|
|
7161
7370
|
localSdp: offer
|
|
7162
7371
|
})
|
|
7163
7372
|
});
|
|
7164
|
-
case
|
|
7165
|
-
res =
|
|
7373
|
+
case 33:
|
|
7374
|
+
res = _context6.sent;
|
|
7166
7375
|
this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
7167
7376
|
headers: res.response.headers
|
|
7168
7377
|
});
|
|
7169
7378
|
answer = res === null || res === void 0 ? void 0 : res.data;
|
|
7170
7379
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
|
|
7171
|
-
|
|
7380
|
+
_context6.next = 41;
|
|
7172
7381
|
break;
|
|
7173
7382
|
}
|
|
7174
7383
|
err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
|
|
7175
7384
|
err.errorType = ERR.NETWORK;
|
|
7176
7385
|
this._emitError(err);
|
|
7177
|
-
return
|
|
7178
|
-
case
|
|
7386
|
+
return _context6.abrupt("return");
|
|
7387
|
+
case 41:
|
|
7179
7388
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
|
|
7180
|
-
|
|
7389
|
+
_context6.next = 43;
|
|
7181
7390
|
break;
|
|
7182
7391
|
}
|
|
7183
7392
|
throw new Error("code: ".concat(answer === null || answer === void 0 ? void 0 : answer.code, ", message:").concat(answer === null || answer === void 0 ? void 0 : answer.message));
|
|
7184
|
-
case
|
|
7393
|
+
case 43:
|
|
7185
7394
|
logger.log("answer:");
|
|
7186
7395
|
logger.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
|
|
7187
7396
|
_parsed = lib.parse(answer.remoteSdp.sdp);
|
|
@@ -7210,86 +7419,123 @@
|
|
|
7210
7419
|
answer.remoteSdp.sdp = lib.write(_parsed);
|
|
7211
7420
|
logger.log("answer modified:\n", answer.remoteSdp.sdp);
|
|
7212
7421
|
this._rctConnectStartTs = Date.now();
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7422
|
+
if (!(pc.signalingState === "closed")) {
|
|
7423
|
+
_context6.next = 53;
|
|
7424
|
+
break;
|
|
7425
|
+
}
|
|
7426
|
+
return _context6.abrupt("return");
|
|
7427
|
+
case 53:
|
|
7428
|
+
_context6.next = 55;
|
|
7429
|
+
return pc.setRemoteDescription(answer.remoteSdp);
|
|
7430
|
+
case 55:
|
|
7216
7431
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
7217
|
-
|
|
7432
|
+
this._listenPeerStateTimeout();
|
|
7433
|
+
_context6.next = 62;
|
|
7218
7434
|
break;
|
|
7219
|
-
case
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
this._emitError(StreamingError.network(
|
|
7223
|
-
case
|
|
7435
|
+
case 59:
|
|
7436
|
+
_context6.prev = 59;
|
|
7437
|
+
_context6.t0 = _context6["catch"](24);
|
|
7438
|
+
this._emitError(StreamingError.network(_context6.t0));
|
|
7439
|
+
case 62:
|
|
7224
7440
|
case "end":
|
|
7225
|
-
return
|
|
7441
|
+
return _context6.stop();
|
|
7226
7442
|
}
|
|
7227
|
-
},
|
|
7443
|
+
}, _callee6, this, [[24, 59]]);
|
|
7228
7444
|
}));
|
|
7229
7445
|
function _connect() {
|
|
7230
7446
|
return _connect2.apply(this, arguments);
|
|
7231
7447
|
}
|
|
7232
7448
|
return _connect;
|
|
7233
7449
|
}()
|
|
7450
|
+
}, {
|
|
7451
|
+
key: "_listenPeerStateTimeout",
|
|
7452
|
+
value: function _listenPeerStateTimeout() {
|
|
7453
|
+
var _this6 = this;
|
|
7454
|
+
this._peerStateTimer && this._clearPeerStateTimeout();
|
|
7455
|
+
if (this._opts.connectionStateChangeTimeout) {
|
|
7456
|
+
this._peerStateTimer = setTimeout(function() {
|
|
7457
|
+
_this6._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
|
|
7458
|
+
message: "listen connectionstatechange timeout"
|
|
7459
|
+
}));
|
|
7460
|
+
}, this._opts.connectionStateChangeTimeout);
|
|
7461
|
+
}
|
|
7462
|
+
}
|
|
7463
|
+
}, {
|
|
7464
|
+
key: "_clearPeerStateTimeout",
|
|
7465
|
+
value: function _clearPeerStateTimeout() {
|
|
7466
|
+
clearTimeout(this._peerStateTimer);
|
|
7467
|
+
this._peerStateTimer = null;
|
|
7468
|
+
}
|
|
7234
7469
|
}, {
|
|
7235
7470
|
key: "_startRtcReport",
|
|
7236
7471
|
value: function _startRtcReport() {
|
|
7237
|
-
var
|
|
7472
|
+
var _this7 = this;
|
|
7238
7473
|
this._stopRtcReport();
|
|
7239
|
-
this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
7240
|
-
var
|
|
7241
|
-
|
|
7474
|
+
this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7() {
|
|
7475
|
+
var _this7$_audioTranscei, _this7$_videoTranscei;
|
|
7476
|
+
var _yield$Promise$all3, _yield$Promise$all4, curAudioStats, curVideoStats, _this7$_audioStallObs, _this7$_videoStallObs, _this7$_networkQualit, _this7$_networkQualit2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref6, _ref7, quality, qualityInfo, av_sync_diff;
|
|
7477
|
+
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
7242
7478
|
while (1)
|
|
7243
|
-
switch (
|
|
7479
|
+
switch (_context7.prev = _context7.next) {
|
|
7244
7480
|
case 0:
|
|
7245
|
-
if (!
|
|
7246
|
-
|
|
7247
|
-
|
|
7481
|
+
if (!(!((_this7$_audioTranscei = _this7._audioTransceicer) !== null && _this7$_audioTranscei !== void 0 && _this7$_audioTranscei.receiver) || !((_this7$_videoTranscei = _this7._videoTransceicer) !== null && _this7$_videoTranscei !== void 0 && _this7$_videoTranscei.receiver))) {
|
|
7482
|
+
_context7.next = 4;
|
|
7483
|
+
break;
|
|
7248
7484
|
}
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7485
|
+
_this7._preAudioStats = null;
|
|
7486
|
+
_this7._preVideoStats = null;
|
|
7487
|
+
return _context7.abrupt("return");
|
|
7488
|
+
case 4:
|
|
7489
|
+
if (!_this7._audioStallObserver && _this7._audioTransceicer) {
|
|
7490
|
+
_this7._audioStallObserver = new AudioStallObserver();
|
|
7491
|
+
_this7._audioStallObserver.start(_this7._audioTransceicer);
|
|
7252
7492
|
}
|
|
7253
|
-
if (!
|
|
7254
|
-
|
|
7493
|
+
if (!_this7._videoStallObserver && _this7._video) {
|
|
7494
|
+
_this7._videoStallObserver = new VideoStallObserver();
|
|
7495
|
+
_this7._videoStallObserver.start(_this7._media);
|
|
7255
7496
|
}
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7497
|
+
if (!_this7._networkQuality && _this7._opts.enableNetworkQuality) {
|
|
7498
|
+
_this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
|
|
7499
|
+
}
|
|
7500
|
+
_context7.next = 9;
|
|
7501
|
+
return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
|
|
7502
|
+
case 9:
|
|
7503
|
+
_yield$Promise$all3 = _context7.sent;
|
|
7504
|
+
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
|
|
7505
|
+
curAudioStats = _yield$Promise$all4[0];
|
|
7506
|
+
curVideoStats = _yield$Promise$all4[1];
|
|
7507
|
+
if (!(_this7._preAudioStats && _this7._preVideoStats)) {
|
|
7508
|
+
_context7.next = 26;
|
|
7265
7509
|
break;
|
|
7266
7510
|
}
|
|
7267
|
-
audioStats = diffRecvAudioStats(
|
|
7268
|
-
videoStats = diffRecvVideoStats(
|
|
7269
|
-
|
|
7270
|
-
return (
|
|
7271
|
-
case
|
|
7272
|
-
audioStallInfo =
|
|
7273
|
-
|
|
7274
|
-
return (
|
|
7511
|
+
audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
|
|
7512
|
+
videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
|
|
7513
|
+
_context7.next = 18;
|
|
7514
|
+
return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
|
|
7515
|
+
case 18:
|
|
7516
|
+
audioStallInfo = _context7.sent;
|
|
7517
|
+
_context7.next = 21;
|
|
7518
|
+
return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
|
|
7275
7519
|
interval: videoStats.statsInterval,
|
|
7276
7520
|
frameRateReceived: videoStats.frameRateReceived,
|
|
7277
7521
|
frameRateDecoded: videoStats.frameRateDecoded,
|
|
7278
7522
|
bitrate: videoStats.receivedKBitrate
|
|
7279
7523
|
});
|
|
7280
|
-
case
|
|
7281
|
-
videoStallInfo =
|
|
7282
|
-
|
|
7524
|
+
case 21:
|
|
7525
|
+
videoStallInfo = _context7.sent;
|
|
7526
|
+
_ref6 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
|
|
7283
7527
|
stallDuration: audioStallInfo.stallDuration
|
|
7284
7528
|
}), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
|
|
7285
|
-
stallDuration: videoStallInfo.stall.stallDuration100ms
|
|
7286
|
-
}))) !== null &&
|
|
7287
|
-
if (
|
|
7288
|
-
|
|
7529
|
+
stallDuration: videoStallInfo.stall.stallDuration100ms || videoStallInfo.stall.stallDuration500ms
|
|
7530
|
+
}))) !== null && _this7$_networkQualit !== void 0 ? _this7$_networkQualit : [], _ref7 = _slicedToArray(_ref6, 2), quality = _ref7[0], qualityInfo = _ref7[1];
|
|
7531
|
+
if (_this7._opts.enableAdaptiveJitterBuffer) {
|
|
7532
|
+
_this7._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this7._opts.adaptiveJitterBuffer, _this7._opts.networkStrategy);
|
|
7289
7533
|
}
|
|
7290
|
-
|
|
7534
|
+
if (videoStats.estimatedPlayoutTimestamp && audioStats.estimatedPlayoutTimestamp) {
|
|
7535
|
+
av_sync_diff = videoStats.estimatedPlayoutTimestamp - audioStats.estimatedPlayoutTimestamp;
|
|
7536
|
+
}
|
|
7537
|
+
_this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
|
|
7291
7538
|
interval: videoStats.statsInterval,
|
|
7292
|
-
visibility_state: document.visibilityState,
|
|
7293
7539
|
network_quality: quality,
|
|
7294
7540
|
audio_stall_duration: audioStallInfo.stallDuration,
|
|
7295
7541
|
audio_stall_count: audioStallInfo.stallCount,
|
|
@@ -7314,17 +7560,21 @@
|
|
|
7314
7560
|
quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
|
|
7315
7561
|
quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
|
|
7316
7562
|
quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
|
|
7317
|
-
current_delay:
|
|
7318
|
-
|
|
7563
|
+
current_delay: _this7._getDelay(),
|
|
7564
|
+
visibility_state: document.visibilityState,
|
|
7565
|
+
target_delay: _this7._targetDelayHint,
|
|
7566
|
+
av_sync_diff,
|
|
7567
|
+
set_delay_error: _this7._setDelayError || null
|
|
7319
7568
|
});
|
|
7320
|
-
case
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7569
|
+
case 26:
|
|
7570
|
+
_this7._preAudioStats = curAudioStats;
|
|
7571
|
+
_this7._preVideoStats = curVideoStats;
|
|
7572
|
+
_this7.set_delay_error = null;
|
|
7573
|
+
case 29:
|
|
7324
7574
|
case "end":
|
|
7325
|
-
return
|
|
7575
|
+
return _context7.stop();
|
|
7326
7576
|
}
|
|
7327
|
-
},
|
|
7577
|
+
}, _callee7);
|
|
7328
7578
|
})), 2e3);
|
|
7329
7579
|
}
|
|
7330
7580
|
}, {
|
|
@@ -7337,15 +7587,21 @@
|
|
|
7337
7587
|
var validNetworkQualityResult = this._networkQualityResult.filter(Boolean);
|
|
7338
7588
|
if (validNetworkQualityResult.length === adaptiveJitterBuffer.networkWindow) {
|
|
7339
7589
|
var _networkStrategy$aver;
|
|
7340
|
-
var
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7590
|
+
var averageQuality;
|
|
7591
|
+
if (adaptiveJitterBuffer.windowMethod === "min") {
|
|
7592
|
+
averageQuality = Math.min.apply(Math, _toConsumableArray$1(validNetworkQualityResult));
|
|
7593
|
+
} else if (adaptiveJitterBuffer.windowMethod === "max") {
|
|
7594
|
+
averageQuality = Math.max.apply(Math, _toConsumableArray$1(validNetworkQualityResult));
|
|
7595
|
+
} else {
|
|
7596
|
+
var sorted = _toConsumableArray$1(validNetworkQualityResult).sort(function(a, b) {
|
|
7597
|
+
return a - b;
|
|
7598
|
+
});
|
|
7599
|
+
var mid = Math.floor(sorted.length / 2);
|
|
7600
|
+
averageQuality = sorted.length % 2 !== 0 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
|
|
7601
|
+
}
|
|
7345
7602
|
if (averageQuality && ((_networkStrategy$aver = networkStrategy[averageQuality]) === null || _networkStrategy$aver === void 0 ? void 0 : _networkStrategy$aver.jitterBuffer) !== void 0) {
|
|
7346
|
-
var _networkStrategy$aver2
|
|
7347
|
-
this.
|
|
7348
|
-
return (_networkStrategy$aver3 = networkStrategy[averageQuality]) === null || _networkStrategy$aver3 === void 0 ? void 0 : _networkStrategy$aver3.jitterBuffer;
|
|
7603
|
+
var _networkStrategy$aver2;
|
|
7604
|
+
this._startSetDelayLoop((_networkStrategy$aver2 = networkStrategy[averageQuality]) === null || _networkStrategy$aver2 === void 0 ? void 0 : _networkStrategy$aver2.jitterBuffer);
|
|
7349
7605
|
}
|
|
7350
7606
|
}
|
|
7351
7607
|
}
|
|
@@ -7359,6 +7615,8 @@
|
|
|
7359
7615
|
this._audioStallObserver = null;
|
|
7360
7616
|
this._videoStallObserver = null;
|
|
7361
7617
|
this._networkQuality = null;
|
|
7618
|
+
this._preAudioStats = null;
|
|
7619
|
+
this._preVideoStats = null;
|
|
7362
7620
|
if (this._rtcReportTimer) {
|
|
7363
7621
|
clearInterval(this._rtcReportTimer);
|
|
7364
7622
|
this._rtcReportTimer = 0;
|
|
@@ -7371,6 +7629,8 @@
|
|
|
7371
7629
|
(_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
|
|
7372
7630
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
7373
7631
|
this._stopRtcReport();
|
|
7632
|
+
clearTimeout(this._checkStatsErrorTimer);
|
|
7633
|
+
this._clearPeerStateTimeout();
|
|
7374
7634
|
this._audioTransceicer = null;
|
|
7375
7635
|
this._videoTransceicer = null;
|
|
7376
7636
|
this._mediaStream = null;
|
|
@@ -7381,10 +7641,40 @@
|
|
|
7381
7641
|
value: function _emitError(error) {
|
|
7382
7642
|
this.emit(EVENT.ERROR, error);
|
|
7383
7643
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7644
|
+
this._clearPeerStateTimeout();
|
|
7384
7645
|
if (this._pc) {
|
|
7385
7646
|
this._pc.close();
|
|
7647
|
+
if (this._media) {
|
|
7648
|
+
this._media.srcObject = null;
|
|
7649
|
+
}
|
|
7386
7650
|
}
|
|
7387
7651
|
}
|
|
7652
|
+
}, {
|
|
7653
|
+
key: "_createEmptyPeer",
|
|
7654
|
+
value: function() {
|
|
7655
|
+
var _createEmptyPeer2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee8() {
|
|
7656
|
+
var pc;
|
|
7657
|
+
return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
|
|
7658
|
+
while (1)
|
|
7659
|
+
switch (_context8.prev = _context8.next) {
|
|
7660
|
+
case 0:
|
|
7661
|
+
pc = new RTCPeerConnection();
|
|
7662
|
+
_context8.next = 3;
|
|
7663
|
+
return pc.createOffer();
|
|
7664
|
+
case 3:
|
|
7665
|
+
pc.close();
|
|
7666
|
+
pc = null;
|
|
7667
|
+
case 5:
|
|
7668
|
+
case "end":
|
|
7669
|
+
return _context8.stop();
|
|
7670
|
+
}
|
|
7671
|
+
}, _callee8);
|
|
7672
|
+
}));
|
|
7673
|
+
function _createEmptyPeer() {
|
|
7674
|
+
return _createEmptyPeer2.apply(this, arguments);
|
|
7675
|
+
}
|
|
7676
|
+
return _createEmptyPeer;
|
|
7677
|
+
}()
|
|
7388
7678
|
}, {
|
|
7389
7679
|
key: "destroy",
|
|
7390
7680
|
value: function destroy(keepClearMediaStream) {
|
|
@@ -7525,7 +7815,7 @@
|
|
|
7525
7815
|
}, {
|
|
7526
7816
|
key: "version",
|
|
7527
7817
|
get: function get() {
|
|
7528
|
-
return "0.2.1-alpha.
|
|
7818
|
+
return "0.2.1-alpha.42";
|
|
7529
7819
|
}
|
|
7530
7820
|
}, {
|
|
7531
7821
|
key: "beforePlayerInit",
|