@techsee/techsee-media-service 999.0.2-switch → 999.0.3-alpha2
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/lib/LocalStreamManager.d.ts +12 -0
- package/lib/LocalStreamManager.d.ts.map +1 -1
- package/lib/LocalStreamManager.js +440 -283
- package/lib/LocalStreamManager.js.map +1 -1
- package/lib/MediaConstants.d.ts +14 -4
- package/lib/MediaConstants.d.ts.map +1 -1
- package/lib/MediaConstants.js +83 -38
- package/lib/MediaConstants.js.map +1 -1
- package/lib/MediaContracts.d.ts +17 -14
- package/lib/MediaContracts.d.ts.map +1 -1
- package/lib/MediaContracts.js +3 -3
- package/lib/MediaContracts.js.map +1 -1
- package/lib/MediaPublisher.d.ts +3 -3
- package/lib/MediaPublisher.d.ts.map +1 -1
- package/lib/MediaPublisher.js +46 -35
- package/lib/MediaPublisher.js.map +1 -1
- package/lib/MediaServiceBase.d.ts +21 -7
- package/lib/MediaServiceBase.d.ts.map +1 -1
- package/lib/MediaServiceBase.js +924 -586
- package/lib/MediaServiceBase.js.map +1 -1
- package/lib/MediaSession/MediaServer.d.ts +45 -0
- package/lib/MediaSession/MediaServer.d.ts.map +1 -0
- package/lib/MediaSession/MediaServer.js +538 -0
- package/lib/MediaSession/MediaServer.js.map +1 -0
- package/lib/MediaSession/MediaSessionBase.d.ts +10 -1
- package/lib/MediaSession/MediaSessionBase.d.ts.map +1 -1
- package/lib/MediaSession/MediaSessionBase.js +128 -66
- package/lib/MediaSession/MediaSessionBase.js.map +1 -1
- package/lib/MediaSession/SessionOpentok.d.ts +11 -9
- package/lib/MediaSession/SessionOpentok.d.ts.map +1 -1
- package/lib/MediaSession/SessionOpentok.js +500 -352
- package/lib/MediaSession/SessionOpentok.js.map +1 -1
- package/lib/MediaSession/SessionTurn.d.ts +4 -1
- package/lib/MediaSession/SessionTurn.d.ts.map +1 -1
- package/lib/MediaSession/SessionTurn.js +611 -422
- package/lib/MediaSession/SessionTurn.js.map +1 -1
- package/lib/MediaSession/TurnConstants.js +31 -30
- package/lib/MediaSession/TurnConstants.js.map +1 -1
- package/lib/MediaSubscriber.d.ts +11 -11
- package/lib/MediaSubscriber.d.ts.map +1 -1
- package/lib/MediaSubscriber.js +236 -192
- package/lib/MediaSubscriber.js.map +1 -1
- package/lib/MediaUtils/Compatibility.d.ts +2 -1
- package/lib/MediaUtils/Compatibility.d.ts.map +1 -1
- package/lib/MediaUtils/Compatibility.js +130 -85
- package/lib/MediaUtils/Compatibility.js.map +1 -1
- package/lib/MediaUtils/MediaDomUtils.d.ts +3 -2
- package/lib/MediaUtils/MediaDomUtils.d.ts.map +1 -1
- package/lib/MediaUtils/MediaDomUtils.js +235 -174
- package/lib/MediaUtils/MediaDomUtils.js.map +1 -1
- package/lib/MediaUtils/MediaTracer.js +9 -4
- package/lib/MediaUtils/MediaTracer.js.map +1 -1
- package/lib/MediaUtils/index.d.ts +1 -0
- package/lib/MediaUtils/index.d.ts.map +1 -0
- package/lib/MediaUtils/index.js +16 -0
- package/lib/MediaUtils/index.js.map +1 -0
- package/lib/MultiParty/Contracts.d.ts +16 -0
- package/lib/MultiParty/Contracts.d.ts.map +1 -0
- package/lib/MultiParty/Contracts.js +6 -0
- package/lib/MultiParty/Contracts.js.map +1 -0
- package/lib/MultiParty/DetectWebRtcService.d.ts +16 -0
- package/lib/MultiParty/DetectWebRtcService.d.ts.map +1 -0
- package/lib/MultiParty/DetectWebRtcService.js +79 -0
- package/lib/MultiParty/DetectWebRtcService.js.map +1 -0
- package/lib/MultiParty/MediaCapabilitiesService.d.ts +23 -0
- package/lib/MultiParty/MediaCapabilitiesService.d.ts.map +1 -0
- package/lib/MultiParty/MediaCapabilitiesService.js +369 -0
- package/lib/MultiParty/MediaCapabilitiesService.js.map +1 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.d.ts +5 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.d.ts.map +1 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.js +305 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.js.map +1 -0
- package/lib/MultiParty/MultiPartyService.d.ts +40 -0
- package/lib/MultiParty/MultiPartyService.d.ts.map +1 -0
- package/lib/MultiParty/MultiPartyService.js +70 -0
- package/lib/MultiParty/MultiPartyService.js.map +1 -0
- package/lib/MultiParty/MultiPartyServiceFactory.d.ts +3 -0
- package/lib/MultiParty/MultiPartyServiceFactory.d.ts.map +1 -0
- package/lib/MultiParty/MultiPartyServiceFactory.js +21 -0
- package/lib/MultiParty/MultiPartyServiceFactory.js.map +1 -0
- package/lib/MultiParty/OpentokMultiPartyService.d.ts +29 -0
- package/lib/MultiParty/OpentokMultiPartyService.d.ts.map +1 -0
- package/lib/MultiParty/OpentokMultiPartyService.js +888 -0
- package/lib/MultiParty/OpentokMultiPartyService.js.map +1 -0
- package/lib/MultiParty/VideoLayoutType.d.ts +4 -0
- package/lib/MultiParty/VideoLayoutType.d.ts.map +1 -0
- package/lib/MultiParty/VideoLayoutType.js +13 -0
- package/lib/MultiParty/VideoLayoutType.js.map +1 -0
- package/lib/MultiParty/index.d.ts +4 -0
- package/lib/MultiParty/index.d.ts.map +1 -0
- package/lib/MultiParty/index.js +61 -0
- package/lib/MultiParty/index.js.map +1 -0
- package/lib/MultiParty/opentok.d.ts +503 -0
- package/lib/TechseeMediaStream.d.ts +6 -6
- package/lib/TechseeMediaStream.d.ts.map +1 -1
- package/lib/TechseeMediaStream.js +59 -53
- package/lib/TechseeMediaStream.js.map +1 -1
- package/lib/oldCode/constants.js +20 -15
- package/lib/oldCode/constants.js.map +1 -1
- package/lib/oldCode/event-emitter.js +45 -22
- package/lib/oldCode/event-emitter.js.map +1 -1
- package/lib/oldCode/index.js +48 -52
- package/lib/oldCode/index.js.map +1 -1
- package/lib/oldCode/opentok/session.js +261 -236
- package/lib/oldCode/opentok/session.js.map +1 -1
- package/lib/oldCode/opentok/stream.js +283 -269
- package/lib/oldCode/opentok/stream.js.map +1 -1
- package/lib/oldCode/publisher.js +96 -71
- package/lib/oldCode/publisher.js.map +1 -1
- package/lib/oldCode/service.js +294 -272
- package/lib/oldCode/service.js.map +1 -1
- package/lib/oldCode/session.js +82 -60
- package/lib/oldCode/session.js.map +1 -1
- package/lib/oldCode/stream.js +153 -125
- package/lib/oldCode/stream.js.map +1 -1
- package/lib/oldCode/subscriber.js +60 -35
- package/lib/oldCode/subscriber.js.map +1 -1
- package/lib/oldCode/tracer.d.ts +3 -2
- package/lib/oldCode/tracer.d.ts.map +1 -1
- package/lib/oldCode/tracer.js +181 -130
- package/lib/oldCode/tracer.js.map +1 -1
- package/lib/oldCode/utils/ImageFixer.js +67 -44
- package/lib/oldCode/utils/ImageFixer.js.map +1 -1
- package/lib/oldCode/webrtc/constants.js +102 -110
- package/lib/oldCode/webrtc/constants.js.map +1 -1
- package/lib/oldCode/webrtc/helper.js +176 -124
- package/lib/oldCode/webrtc/helper.js.map +1 -1
- package/lib/oldCode/webrtc/session-kms.js +408 -393
- package/lib/oldCode/webrtc/session-kms.js.map +1 -1
- package/lib/oldCode/webrtc/session-loopback.js +245 -227
- package/lib/oldCode/webrtc/session-loopback.js.map +1 -1
- package/lib/oldCode/webrtc/session-turn.js +705 -658
- package/lib/oldCode/webrtc/session-turn.js.map +1 -1
- package/lib/oldCode/webrtc/session-turn.v2.js +480 -471
- package/lib/oldCode/webrtc/session-turn.v2.js.map +1 -1
- package/lib/oldCode/webrtc/session.js +12 -6
- package/lib/oldCode/webrtc/session.js.map +1 -1
- package/lib/oldCode/webrtc/stream.js +526 -504
- package/lib/oldCode/webrtc/stream.js.map +1 -1
- package/lib/oldCode/webrtc/temasys/adapter-loader.js +5 -6
- package/lib/oldCode/webrtc/temasys/adapter-loader.js.map +1 -1
- package/lib/oldCode/webrtc/temasys/adapter.js +5264 -5192
- package/lib/oldCode/webrtc/temasys/adapter.js.map +1 -1
- package/lib/oldCode/webrtc/webrtc-ie-shim.js +3357 -2927
- package/lib/oldCode/webrtc/webrtc-ie-shim.js.map +1 -1
- package/lib/qos/raw-qos.js +348 -273
- package/lib/qos/raw-qos.js.map +1 -1
- package/lib/webrtc-ie-shim.js +3386 -2985
- package/lib/webrtc-ie-shim.js.map +1 -1
- package/package.json +54 -42
package/lib/qos/raw-qos.js
CHANGED
|
@@ -1,319 +1,394 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RawQos = void 0;
|
|
4
7
|
|
|
5
|
-
function
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
6
9
|
|
|
7
|
-
var
|
|
8
|
-
function RawQos() {
|
|
9
|
-
_classCallCheck(this, RawQos);
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13
|
+
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
+
|
|
16
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
this.rawQoSEntry = {};
|
|
17
|
-
this.enableRawEntries = true;
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
var RawQos = /*#__PURE__*/function () {
|
|
21
|
+
function RawQos() {
|
|
22
|
+
_classCallCheck(this, RawQos);
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
if (RawQos.instance) {
|
|
25
|
+
return RawQos.instance;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
this.VIDEO_CODECS = ['vp9', 'vp8', 'h264'];
|
|
29
|
+
this.rawQoSEntry = {};
|
|
30
|
+
this.enableRawEntries = true;
|
|
31
|
+
this.bytesPrev = null;
|
|
32
|
+
this.timestampPrev = null;
|
|
33
|
+
this.startTimestamp = null;
|
|
34
|
+
RawQos.instance = this;
|
|
35
|
+
}
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
_createClass(RawQos, [{
|
|
38
|
+
key: "parse",
|
|
39
|
+
value: function parse(stats) {
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
41
|
+
var self = this;
|
|
42
|
+
self.rawQoSEntry = {};
|
|
31
43
|
|
|
32
|
-
|
|
33
|
-
var _ref;
|
|
44
|
+
self._clearRaw();
|
|
34
45
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
var _iterator = _createForOfIteratorHelper(stats.values()),
|
|
47
|
+
_step;
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
51
|
+
var stat = _step.value;
|
|
52
|
+
|
|
53
|
+
if (!stat.isRemote) {
|
|
54
|
+
switch (stat.type) {
|
|
55
|
+
case 'outbound-rtp':
|
|
56
|
+
{
|
|
57
|
+
self._addRaw(stat);
|
|
58
|
+
|
|
59
|
+
self._parseOutStats(stat, self.rawQoSEntry);
|
|
60
|
+
|
|
61
|
+
var remote = stats.get(stat.remoteId);
|
|
62
|
+
|
|
63
|
+
if (remote) {
|
|
64
|
+
self._addRaw(remote);
|
|
65
|
+
|
|
66
|
+
self.rawQoSEntry.remote = {};
|
|
43
67
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
self._addRaw(stat);
|
|
51
|
-
self._parseOutStats(stat, self.rawQoSEntry);
|
|
52
|
-
|
|
53
|
-
var remote = stats.get(stat.remoteId);
|
|
54
|
-
|
|
55
|
-
if (remote) {
|
|
56
|
-
self._addRaw(remote);
|
|
57
|
-
self.rawQoSEntry.remote = {};
|
|
58
|
-
self._parseInStats(remote, self.rawQoSEntry.remote);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this._parseRelated(stats, stat, self);
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
case 'inbound-rtp':
|
|
65
|
-
{
|
|
66
|
-
self._addRaw(stat);
|
|
67
|
-
self._parseInStats(stat, self.rawQoSEntry);
|
|
68
|
-
|
|
69
|
-
var _remote = stats.get(stat.remoteId);
|
|
70
|
-
|
|
71
|
-
if (_remote) {
|
|
72
|
-
self._addRaw(_remote);
|
|
73
|
-
self.rawQoSEntry.remote = {};
|
|
74
|
-
self._parseOutStats(_remote, self.rawQoSEntry.remote);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
this._parseRelated(stats, stat, self);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
case 'remote-inbound-rtp':
|
|
81
|
-
{
|
|
82
|
-
self._addRaw(stat);
|
|
83
|
-
self.rawQoSEntry.remote = {};
|
|
84
|
-
self._parseInStats(stat, self.rawQoSEntry.remote);
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
case 'remote-outbound-rtp':
|
|
88
|
-
{
|
|
89
|
-
self._addRaw(stat);
|
|
90
|
-
self.rawQoSEntry.remote = {};
|
|
91
|
-
self._parseOutStats(stat, self.rawQoSEntry.remote);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case 'candidate-pair':
|
|
95
|
-
{
|
|
96
|
-
if ((stat.bytesSent > 0 || stat.bytesReceived > 0) && (!self.rawQoSEntry.servers || stat.bytesSent > self.rawQoSEntry.servers.bytesSent || stat.bytesReceived > self.rawQoSEntry.servers.bytesReceived)) {
|
|
97
|
-
self.rawQoSEntry.servers = {};
|
|
98
|
-
self._addRaw(stat);
|
|
99
|
-
self._parseServerStats(stat, self.rawQoSEntry.servers, stats);
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
case 'track':
|
|
104
|
-
{
|
|
105
|
-
self.track = stat;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
68
|
+
self._parseInStats(remote, self.rawQoSEntry.remote);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this._parseRelated(stats, stat, self);
|
|
72
|
+
|
|
73
|
+
break;
|
|
108
74
|
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
75
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
self.track = null;
|
|
76
|
+
case 'inbound-rtp':
|
|
77
|
+
{
|
|
78
|
+
self._addRaw(stat);
|
|
117
79
|
|
|
118
|
-
|
|
119
|
-
};
|
|
80
|
+
self._parseInStats(stat, self.rawQoSEntry);
|
|
120
81
|
|
|
121
|
-
|
|
122
|
-
var track = stats.get(stat.trackId);
|
|
82
|
+
var _remote = stats.get(stat.remoteId);
|
|
123
83
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
self._parseTrack(track, self.rawQoSEntry);
|
|
127
|
-
}
|
|
84
|
+
if (_remote) {
|
|
85
|
+
self._addRaw(_remote);
|
|
128
86
|
|
|
129
|
-
|
|
87
|
+
self.rawQoSEntry.remote = {};
|
|
130
88
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
self._parseCodec(codec, self.rawQoSEntry);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
89
|
+
self._parseOutStats(_remote, self.rawQoSEntry.remote);
|
|
90
|
+
}
|
|
136
91
|
|
|
137
|
-
|
|
138
|
-
if (this.enableRawEntries) {
|
|
139
|
-
this.rawQoSEntry.raw = [];
|
|
140
|
-
}
|
|
141
|
-
};
|
|
92
|
+
this._parseRelated(stats, stat, self);
|
|
142
93
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (!this.rawQoSEntry.raw) {
|
|
146
|
-
this.rawQoSEntry.raw = [];
|
|
147
|
-
}
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
148
96
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
97
|
+
case 'remote-inbound-rtp':
|
|
98
|
+
{
|
|
99
|
+
self._addRaw(stat);
|
|
152
100
|
|
|
153
|
-
|
|
154
|
-
parent.bytesSent = result.bytesSent;
|
|
155
|
-
parent.bytesReceived = result.bytesReceived;
|
|
156
|
-
if (typeof result.totalRoundTripTime === 'number') {
|
|
157
|
-
parent.totalRoundTripTime = result.totalRoundTripTime;
|
|
158
|
-
}
|
|
159
|
-
if (typeof result.currentRoundTripTime === 'number') {
|
|
160
|
-
parent.currentRoundTripTime = result.currentRoundTripTime;
|
|
161
|
-
}
|
|
162
|
-
if (typeof result.availableOutgoingBitrate === 'number') {
|
|
163
|
-
parent.availableOutgoingBitrate = result.availableOutgoingBitrate;
|
|
164
|
-
}
|
|
101
|
+
self.rawQoSEntry.remote = {};
|
|
165
102
|
|
|
166
|
-
|
|
103
|
+
self._parseInStats(stat, self.rawQoSEntry.remote);
|
|
167
104
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
this._parseLocal(localCandidate, parent);
|
|
171
|
-
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
172
107
|
|
|
173
|
-
|
|
108
|
+
case 'remote-outbound-rtp':
|
|
109
|
+
{
|
|
110
|
+
self._addRaw(stat);
|
|
174
111
|
|
|
175
|
-
|
|
176
|
-
this._addRaw(remoteCandidate);
|
|
177
|
-
this._parseRemote(remoteCandidate, parent);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
112
|
+
self.rawQoSEntry.remote = {};
|
|
180
113
|
|
|
181
|
-
|
|
182
|
-
if (result.mimeType) {
|
|
183
|
-
var index = this.VIDEO_CODECS.findIndex(function (codec) {
|
|
184
|
-
return result.mimeType.toLowerCase().includes(codec);
|
|
185
|
-
});
|
|
114
|
+
self._parseOutStats(stat, self.rawQoSEntry.remote);
|
|
186
115
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
RawQos.prototype._parseLocal = function _parseLocal(result, parent) {
|
|
194
|
-
parent.localIP = result.ip || result.ipAddress;
|
|
195
|
-
parent.localPort = result.port || result.portNumber;
|
|
196
|
-
parent.localProtocol = result.protocol || result.transport;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
RawQos.prototype._parseRemote = function _parseRemote(result, parent) {
|
|
200
|
-
parent.remoteIP = result.ip || result.ipAddress;
|
|
201
|
-
parent.remotePort = result.port || result.portNumber;
|
|
202
|
-
parent.remoteProtocol = result.protocol || result.transport;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
RawQos.prototype._parseTrack = function _parseTrack(result, parent) {
|
|
206
|
-
if (typeof result.frameWidth === 'number') {
|
|
207
|
-
parent.frameWidth = result.frameWidth;
|
|
208
|
-
}
|
|
209
|
-
if (typeof result.frameHeight === 'number') {
|
|
210
|
-
parent.frameHeight = result.frameHeight;
|
|
211
|
-
}
|
|
212
|
-
if (typeof result.framesPerSecond === 'number') {
|
|
213
|
-
parent.videoFrameRate = result.framesPerSecond;
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
RawQos.prototype._parseOutStats = function _parseOutStats(result, parent) {
|
|
218
|
-
parent.isPublisher = true;
|
|
219
|
-
parent.videoSentPackets = result.packetsSent;
|
|
220
|
-
parent.videoSentPacketsLost = result.packetsLost;
|
|
221
|
-
parent.videoSentBytes = result.bytesSent;
|
|
222
|
-
this._parseBitrate(result, parent, parent.videoSentBytes);
|
|
223
|
-
this._parseFrameRate(result, parent, parent.videoSentBytes);
|
|
224
|
-
this._parseOther(result, parent);
|
|
225
|
-
this._saveSomeMetrics(parent, result);
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
RawQos.prototype._parseVideoDuration = function _parseVideoDuration(result, parent) {
|
|
229
|
-
if (!this.startTimestamp) {
|
|
230
|
-
this.startTimestamp = result.timestamp;
|
|
231
|
-
}
|
|
232
|
-
parent.videoDuration = ((result.timestamp - this.startTimestamp) / 1000).toFixed(2);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
RawQos.prototype._parseInStats = function _parseInStats(result, parent) {
|
|
236
|
-
parent.isSubscriber = true;
|
|
237
|
-
parent.videoReceivedPackets = result.packetsReceived;
|
|
238
|
-
parent.videoReceivedPacketsLost = result.packetsLost;
|
|
239
|
-
parent.videoReceivedBytes = result.bytesReceived;
|
|
240
|
-
this._parseBitrate(result, parent, parent.videoReceivedBytes);
|
|
241
|
-
this._parseFrameRate(result, parent, parent.videoReceivedBytes);
|
|
242
|
-
this._parseOther(result, parent);
|
|
243
|
-
this._saveSomeMetrics(parent, result);
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
RawQos.prototype._saveSomeMetrics = function _saveSomeMetrics(parent, result) {
|
|
247
|
-
if (parent === this.rawQoSEntry) {
|
|
248
|
-
this.bytesPrev = parent.videoReceivedBytes;
|
|
249
|
-
this.timestampPrev = result.timestamp;
|
|
250
|
-
this.ssrcPrev = result.ssrc;
|
|
251
|
-
this.framesDecodedPrev = result.framesDecoded;
|
|
252
|
-
this._parseVideoDuration(result, parent);
|
|
253
|
-
}
|
|
254
|
-
};
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
255
118
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (typeof result.jitter === 'number') {
|
|
263
|
-
parent.jitter = result.jitter;
|
|
264
|
-
}
|
|
265
|
-
if (typeof result.packetsRepaired === 'number') {
|
|
266
|
-
parent.packetsRepaired = result.packetsRepaired;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
119
|
+
case 'candidate-pair':
|
|
120
|
+
{
|
|
121
|
+
if ((stat.bytesSent > 0 || stat.bytesReceived > 0) && (!self.rawQoSEntry.servers || stat.bytesSent > self.rawQoSEntry.servers.bytesSent || stat.bytesReceived > self.rawQoSEntry.servers.bytesReceived)) {
|
|
122
|
+
self.rawQoSEntry.servers = {};
|
|
123
|
+
|
|
124
|
+
self._addRaw(stat);
|
|
269
125
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (typeof result.bitrateMean === 'number') {
|
|
273
|
-
parent.videoBitRate = result.bitrateMean.toFixed(2);
|
|
274
|
-
} else if (this.bytesPrev && this.timestampPrev) {
|
|
275
|
-
var totalBytes = bytes;
|
|
126
|
+
self._parseServerStats(stat, self.rawQoSEntry.servers, stats);
|
|
127
|
+
}
|
|
276
128
|
|
|
277
|
-
|
|
278
|
-
totalBytes = bytes - this.bytesPrev;
|
|
129
|
+
break;
|
|
279
130
|
}
|
|
280
131
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
RawQos.prototype._parseFrameRate = function _parseFrameRate(result, parent, bytes) {
|
|
289
|
-
if (bytes > 0) {
|
|
290
|
-
if (typeof result.framerateMean === 'number') {
|
|
291
|
-
parent.videoFrameRate = Number(result.framerateMean).toFixed(2);
|
|
292
|
-
} else if (this.framesDecodedPrev && this.timestampPrev) {
|
|
293
|
-
if (result.framesDecoded >= this.framesDecodedPrev && result.timestamp > this.timestampPrev) {
|
|
294
|
-
parent.videoFrameRate = ((result.framesDecoded - this.framesDecodedPrev) / ((result.timestamp - this.timestampPrev) / 1000)).toFixed(2);
|
|
132
|
+
case 'track':
|
|
133
|
+
{
|
|
134
|
+
self.track = stat;
|
|
135
|
+
break;
|
|
295
136
|
}
|
|
296
137
|
}
|
|
297
|
-
|
|
298
|
-
parent.videoFrameRate = 0;
|
|
138
|
+
}
|
|
299
139
|
}
|
|
300
|
-
|
|
140
|
+
} catch (err) {
|
|
141
|
+
_iterator.e(err);
|
|
142
|
+
} finally {
|
|
143
|
+
_iterator.f();
|
|
144
|
+
}
|
|
301
145
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
var index = 0;
|
|
146
|
+
if (!self.rawQoSEntry.frameWidth && self.track) {
|
|
147
|
+
self._addRaw(self.track);
|
|
305
148
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
149
|
+
self._parseTrack(self.track, self.rawQoSEntry);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
self.track = null;
|
|
153
|
+
return self.rawQoSEntry;
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "_parseRelated",
|
|
157
|
+
value: function _parseRelated(stats, stat, self) {
|
|
158
|
+
var track = stats.get(stat.trackId);
|
|
159
|
+
|
|
160
|
+
if (track) {
|
|
161
|
+
self._addRaw(track);
|
|
162
|
+
|
|
163
|
+
self._parseTrack(track, self.rawQoSEntry);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var codec = stats.get(stat.codecId);
|
|
167
|
+
|
|
168
|
+
if (codec) {
|
|
169
|
+
self._addRaw(codec);
|
|
170
|
+
|
|
171
|
+
self._parseCodec(codec, self.rawQoSEntry);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "_clearRaw",
|
|
176
|
+
value: function _clearRaw() {
|
|
177
|
+
if (this.enableRawEntries) {
|
|
178
|
+
this.rawQoSEntry.raw = [];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, {
|
|
182
|
+
key: "_addRaw",
|
|
183
|
+
value: function _addRaw(item) {
|
|
184
|
+
if (this.enableRawEntries && item) {
|
|
185
|
+
if (!this.rawQoSEntry.raw) {
|
|
186
|
+
this.rawQoSEntry.raw = [];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
this.rawQoSEntry.raw.push(this._dumpItem(item));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
key: "_parseServerStats",
|
|
194
|
+
value: function _parseServerStats(result, parent, stats) {
|
|
195
|
+
parent.bytesSent = result.bytesSent;
|
|
196
|
+
parent.bytesReceived = result.bytesReceived;
|
|
197
|
+
|
|
198
|
+
if (typeof result.totalRoundTripTime === 'number') {
|
|
199
|
+
parent.totalRoundTripTime = result.totalRoundTripTime;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (typeof result.currentRoundTripTime === 'number') {
|
|
203
|
+
parent.currentRoundTripTime = result.currentRoundTripTime;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (typeof result.availableOutgoingBitrate === 'number') {
|
|
207
|
+
parent.availableOutgoingBitrate = result.availableOutgoingBitrate;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var localCandidate = stats.get(result.localCandidateId);
|
|
211
|
+
|
|
212
|
+
if (localCandidate) {
|
|
213
|
+
this._addRaw(localCandidate);
|
|
214
|
+
|
|
215
|
+
this._parseLocal(localCandidate, parent);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
var remoteCandidate = stats.get(result.remoteCandidateId);
|
|
219
|
+
|
|
220
|
+
if (remoteCandidate) {
|
|
221
|
+
this._addRaw(remoteCandidate);
|
|
222
|
+
|
|
223
|
+
this._parseRemote(remoteCandidate, parent);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}, {
|
|
227
|
+
key: "_parseCodec",
|
|
228
|
+
value: function _parseCodec(result, parent) {
|
|
229
|
+
if (result.mimeType) {
|
|
230
|
+
var index = this.VIDEO_CODECS.findIndex(function (codec) {
|
|
231
|
+
return result.mimeType.toLowerCase().includes(codec);
|
|
311
232
|
});
|
|
312
|
-
statsString += '}';
|
|
313
233
|
|
|
314
|
-
|
|
315
|
-
|
|
234
|
+
if (index >= 0) {
|
|
235
|
+
parent.videoCodec = this.VIDEO_CODECS[index];
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}, {
|
|
240
|
+
key: "_parseLocal",
|
|
241
|
+
value: function _parseLocal(result, parent) {
|
|
242
|
+
parent.localIP = result.ip || result.ipAddress;
|
|
243
|
+
parent.localPort = result.port || result.portNumber;
|
|
244
|
+
parent.localProtocol = result.protocol || result.transport;
|
|
245
|
+
}
|
|
246
|
+
}, {
|
|
247
|
+
key: "_parseRemote",
|
|
248
|
+
value: function _parseRemote(result, parent) {
|
|
249
|
+
parent.remoteIP = result.ip || result.ipAddress;
|
|
250
|
+
parent.remotePort = result.port || result.portNumber;
|
|
251
|
+
parent.remoteProtocol = result.protocol || result.transport;
|
|
252
|
+
}
|
|
253
|
+
}, {
|
|
254
|
+
key: "_parseTrack",
|
|
255
|
+
value: function _parseTrack(result, parent) {
|
|
256
|
+
if (typeof result.frameWidth === 'number') {
|
|
257
|
+
parent.frameWidth = result.frameWidth;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (typeof result.frameHeight === 'number') {
|
|
261
|
+
parent.frameHeight = result.frameHeight;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (typeof result.framesPerSecond === 'number') {
|
|
265
|
+
parent.videoFrameRate = result.framesPerSecond;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}, {
|
|
269
|
+
key: "_parseOutStats",
|
|
270
|
+
value: function _parseOutStats(result, parent) {
|
|
271
|
+
parent.isPublisher = true;
|
|
272
|
+
parent.videoSentPackets = result.packetsSent;
|
|
273
|
+
parent.videoSentPacketsLost = result.packetsLost;
|
|
274
|
+
parent.videoSentBytes = result.bytesSent;
|
|
275
|
+
|
|
276
|
+
this._parseBitrate(result, parent, parent.videoSentBytes);
|
|
277
|
+
|
|
278
|
+
this._parseFrameRate(result, parent, parent.videoSentBytes);
|
|
279
|
+
|
|
280
|
+
this._parseOther(result, parent);
|
|
281
|
+
|
|
282
|
+
this._saveSomeMetrics(parent, result);
|
|
283
|
+
}
|
|
284
|
+
}, {
|
|
285
|
+
key: "_parseVideoDuration",
|
|
286
|
+
value: function _parseVideoDuration(result, parent) {
|
|
287
|
+
if (!this.startTimestamp) {
|
|
288
|
+
this.startTimestamp = result.timestamp;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
parent.videoDuration = ((result.timestamp - this.startTimestamp) / 1000).toFixed(2);
|
|
292
|
+
}
|
|
293
|
+
}, {
|
|
294
|
+
key: "_parseInStats",
|
|
295
|
+
value: function _parseInStats(result, parent) {
|
|
296
|
+
parent.isSubscriber = true;
|
|
297
|
+
parent.videoReceivedPackets = result.packetsReceived;
|
|
298
|
+
parent.videoReceivedPacketsLost = result.packetsLost;
|
|
299
|
+
parent.videoReceivedBytes = result.bytesReceived;
|
|
300
|
+
|
|
301
|
+
this._parseBitrate(result, parent, parent.videoReceivedBytes);
|
|
302
|
+
|
|
303
|
+
this._parseFrameRate(result, parent, parent.videoReceivedBytes);
|
|
304
|
+
|
|
305
|
+
this._parseOther(result, parent);
|
|
316
306
|
|
|
317
|
-
|
|
307
|
+
this._saveSomeMetrics(parent, result);
|
|
308
|
+
}
|
|
309
|
+
}, {
|
|
310
|
+
key: "_saveSomeMetrics",
|
|
311
|
+
value: function _saveSomeMetrics(parent, result) {
|
|
312
|
+
if (parent === this.rawQoSEntry) {
|
|
313
|
+
this.bytesPrev = parent.videoReceivedBytes;
|
|
314
|
+
this.timestampPrev = result.timestamp;
|
|
315
|
+
this.ssrcPrev = result.ssrc;
|
|
316
|
+
this.framesDecodedPrev = result.framesDecoded;
|
|
317
|
+
|
|
318
|
+
this._parseVideoDuration(result, parent);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
322
|
+
key: "_parseOther",
|
|
323
|
+
value: function _parseOther(result, parent) {
|
|
324
|
+
parent.timestamp = result.timestamp;
|
|
325
|
+
parent.ssrc = result.ssrc;
|
|
326
|
+
|
|
327
|
+
if (typeof result.discardedPackets === 'number') {
|
|
328
|
+
parent.discardedPackets = result.discardedPackets;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (typeof result.jitter === 'number') {
|
|
332
|
+
parent.jitter = result.jitter;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (typeof result.packetsRepaired === 'number') {
|
|
336
|
+
parent.packetsRepaired = result.packetsRepaired;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}, {
|
|
340
|
+
key: "_parseBitrate",
|
|
341
|
+
value: function _parseBitrate(result, parent, bytes) {
|
|
342
|
+
if (bytes > 0) {
|
|
343
|
+
if (typeof result.bitrateMean === 'number') {
|
|
344
|
+
parent.videoBitRate = result.bitrateMean.toFixed(2);
|
|
345
|
+
} else if (this.bytesPrev && this.timestampPrev) {
|
|
346
|
+
var totalBytes = bytes;
|
|
347
|
+
|
|
348
|
+
if (result.ssrc === this.ssrcPrev && bytes > this.bytesPrev) {
|
|
349
|
+
totalBytes = bytes - this.bytesPrev;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
parent.videoBitRate = Math.floor(8 * totalBytes / ((result.timestamp - this.timestampPrev) / 1000));
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
parent.videoBitRate = 0;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}, {
|
|
359
|
+
key: "_parseFrameRate",
|
|
360
|
+
value: function _parseFrameRate(result, parent, bytes) {
|
|
361
|
+
if (bytes > 0) {
|
|
362
|
+
if (typeof result.framerateMean === 'number') {
|
|
363
|
+
parent.videoFrameRate = Number(result.framerateMean).toFixed(2);
|
|
364
|
+
} else if (this.framesDecodedPrev && this.timestampPrev) {
|
|
365
|
+
if (result.framesDecoded >= this.framesDecodedPrev && result.timestamp > this.timestampPrev) {
|
|
366
|
+
parent.videoFrameRate = ((result.framesDecoded - this.framesDecodedPrev) / ((result.timestamp - this.timestampPrev) / 1000)).toFixed(2);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
} else {
|
|
370
|
+
parent.videoFrameRate = 0;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}, {
|
|
374
|
+
key: "_dumpItem",
|
|
375
|
+
value: function _dumpItem(res) {
|
|
376
|
+
var statsString = '{';
|
|
377
|
+
var index = 0;
|
|
378
|
+
Object.keys(res).forEach(function (k) {
|
|
379
|
+
statsString += "\"".concat(k, "\": \"").concat(res[k], "\"");
|
|
380
|
+
|
|
381
|
+
if (++index !== res.length) {
|
|
382
|
+
statsString += ',';
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
statsString += '}';
|
|
386
|
+
return statsString;
|
|
387
|
+
}
|
|
388
|
+
}]);
|
|
389
|
+
|
|
390
|
+
return RawQos;
|
|
318
391
|
}();
|
|
392
|
+
|
|
393
|
+
exports.RawQos = RawQos;
|
|
319
394
|
//# sourceMappingURL=raw-qos.js.map
|