@techsee/techsee-media-service 18.6.1 → 19.1.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/lib/LocalStreamManager.d.ts +1 -0
- package/lib/LocalStreamManager.d.ts.map +1 -1
- package/lib/LocalStreamManager.js +320 -441
- package/lib/LocalStreamManager.js.map +1 -1
- package/lib/MediaConstants.d.ts +1 -0
- package/lib/MediaConstants.d.ts.map +1 -1
- package/lib/MediaConstants.js +53 -95
- package/lib/MediaConstants.js.map +1 -1
- package/lib/MediaContracts.d.ts +1 -0
- package/lib/MediaContracts.d.ts.map +1 -1
- package/lib/MediaContracts.js +2 -5
- package/lib/MediaContracts.js.map +1 -1
- package/lib/MediaPublisher.d.ts +1 -0
- package/lib/MediaPublisher.d.ts.map +1 -1
- package/lib/MediaPublisher.js +36 -49
- package/lib/MediaPublisher.js.map +1 -1
- package/lib/MediaServiceBase.d.ts +1 -0
- package/lib/MediaServiceBase.d.ts.map +1 -1
- package/lib/MediaServiceBase.js +687 -937
- package/lib/MediaServiceBase.js.map +1 -1
- package/lib/MediaSession/MediaServer.d.ts +1 -0
- package/lib/MediaSession/MediaServer.d.ts.map +1 -1
- package/lib/MediaSession/MediaServer.js +372 -517
- package/lib/MediaSession/MediaServer.js.map +1 -1
- package/lib/MediaSession/MediaSessionBase.d.ts +1 -0
- package/lib/MediaSession/MediaSessionBase.d.ts.map +1 -1
- package/lib/MediaSession/MediaSessionBase.js +88 -127
- package/lib/MediaSession/MediaSessionBase.js.map +1 -1
- package/lib/MediaSession/SessionOpentok.d.ts +1 -0
- package/lib/MediaSession/SessionOpentok.d.ts.map +1 -1
- package/lib/MediaSession/SessionOpentok.js +357 -503
- package/lib/MediaSession/SessionOpentok.js.map +1 -1
- package/lib/MediaSession/SessionTurn.d.ts +1 -0
- package/lib/MediaSession/SessionTurn.d.ts.map +1 -1
- package/lib/MediaSession/SessionTurn.js +431 -613
- package/lib/MediaSession/SessionTurn.js.map +1 -1
- package/lib/MediaSession/TurnConstants.d.ts +1 -0
- package/lib/MediaSession/TurnConstants.d.ts.map +1 -1
- package/lib/MediaSession/TurnConstants.js +17 -32
- package/lib/MediaSession/TurnConstants.js.map +1 -1
- package/lib/MediaSubscriber.d.ts +1 -0
- package/lib/MediaSubscriber.d.ts.map +1 -1
- package/lib/MediaSubscriber.js +189 -245
- package/lib/MediaSubscriber.js.map +1 -1
- package/lib/MediaUtils/Compatibility.d.ts +1 -0
- package/lib/MediaUtils/Compatibility.d.ts.map +1 -1
- package/lib/MediaUtils/Compatibility.js +129 -283
- package/lib/MediaUtils/Compatibility.js.map +1 -1
- package/lib/MediaUtils/MediaDomUtils.d.ts +1 -0
- package/lib/MediaUtils/MediaDomUtils.d.ts.map +1 -1
- package/lib/MediaUtils/MediaDomUtils.js +184 -252
- package/lib/MediaUtils/MediaDomUtils.js.map +1 -1
- package/lib/MediaUtils/MediaTracer.d.ts +1 -0
- package/lib/MediaUtils/MediaTracer.d.ts.map +1 -1
- package/lib/MediaUtils/MediaTracer.js +3 -10
- package/lib/MediaUtils/MediaTracer.js.map +1 -1
- package/lib/MediaUtils/index.d.ts +1 -0
- package/lib/MediaUtils/index.d.ts.map +1 -1
- package/lib/MediaUtils/index.js +3 -13
- package/lib/MediaUtils/index.js.map +1 -1
- package/lib/MultiParty/DetectWebRtcService.d.ts +1 -0
- package/lib/MultiParty/DetectWebRtcService.d.ts.map +1 -1
- package/lib/MultiParty/DetectWebRtcService.js +92 -241
- package/lib/MultiParty/DetectWebRtcService.js.map +1 -1
- package/lib/MultiParty/MediaCapabilitiesService.d.ts +1 -0
- package/lib/MultiParty/MediaCapabilitiesService.d.ts.map +1 -1
- package/lib/MultiParty/MediaCapabilitiesService.js +143 -312
- package/lib/MultiParty/MediaCapabilitiesService.js.map +1 -1
- package/lib/MultiParty/MediaCapabilitiesUtils.d.ts +1 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.d.ts.map +1 -1
- package/lib/MultiParty/MediaCapabilitiesUtils.js +95 -277
- package/lib/MultiParty/MediaCapabilitiesUtils.js.map +1 -1
- package/lib/MultiParty/MediaTracer.d.ts +1 -0
- package/lib/MultiParty/MediaTracer.d.ts.map +1 -1
- package/lib/MultiParty/MediaTracer.js +3 -10
- package/lib/MultiParty/MediaTracer.js.map +1 -1
- package/lib/MultiParty/MultiPartyService.d.ts +1 -0
- package/lib/MultiParty/MultiPartyService.d.ts.map +1 -1
- package/lib/MultiParty/MultiPartyService.js +24 -47
- package/lib/MultiParty/MultiPartyService.js.map +1 -1
- package/lib/MultiParty/MultiPartyServiceFactory.d.ts +2 -1
- package/lib/MultiParty/MultiPartyServiceFactory.d.ts.map +1 -1
- package/lib/MultiParty/MultiPartyServiceFactory.js +7 -15
- package/lib/MultiParty/MultiPartyServiceFactory.js.map +1 -1
- package/lib/MultiParty/MultipartyServiceEventTypes.d.ts +1 -0
- package/lib/MultiParty/MultipartyServiceEventTypes.d.ts.map +1 -1
- package/lib/MultiParty/MultipartyServiceEventTypes.js +11 -15
- package/lib/MultiParty/MultipartyServiceEventTypes.js.map +1 -1
- package/lib/MultiParty/index.d.ts +1 -0
- package/lib/MultiParty/index.d.ts.map +1 -1
- package/lib/MultiParty/index.js +15 -35
- package/lib/MultiParty/index.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokMultiPartyService.d.ts +2 -1
- package/lib/MultiParty/opentok/OpentokMultiPartyService.d.ts.map +1 -1
- package/lib/MultiParty/opentok/OpentokMultiPartyService.js +457 -839
- package/lib/MultiParty/opentok/OpentokMultiPartyService.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokPublisher.d.ts +1 -0
- package/lib/MultiParty/opentok/OpentokPublisher.d.ts.map +1 -1
- package/lib/MultiParty/opentok/OpentokPublisher.js +107 -269
- package/lib/MultiParty/opentok/OpentokPublisher.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokPublisherEventMapper.d.ts +1 -0
- package/lib/MultiParty/opentok/OpentokPublisherEventMapper.d.ts.map +1 -1
- package/lib/MultiParty/opentok/OpentokPublisherEventMapper.js +34 -54
- package/lib/MultiParty/opentok/OpentokPublisherEventMapper.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokScreenPublisher.d.ts +1 -0
- package/lib/MultiParty/opentok/OpentokScreenPublisher.d.ts.map +1 -1
- package/lib/MultiParty/opentok/OpentokScreenPublisher.js +40 -77
- package/lib/MultiParty/opentok/OpentokScreenPublisher.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokSubscriber.d.ts +1 -0
- package/lib/MultiParty/opentok/OpentokSubscriber.d.ts.map +1 -1
- package/lib/MultiParty/opentok/OpentokSubscriber.js +20 -28
- package/lib/MultiParty/opentok/OpentokSubscriber.js.map +1 -1
- package/lib/MultiParty/opentok/OpentokVideoPublisher.d.ts +1 -0
- package/lib/MultiParty/opentok/OpentokVideoPublisher.d.ts.map +1 -1
- package/lib/MultiParty/opentok/OpentokVideoPublisher.js +150 -355
- package/lib/MultiParty/opentok/OpentokVideoPublisher.js.map +1 -1
- package/lib/MultiParty/opentok/trace.d.ts +1 -0
- package/lib/MultiParty/opentok/trace.d.ts.map +1 -1
- package/lib/MultiParty/opentok/trace.js +11 -24
- package/lib/MultiParty/opentok/trace.js.map +1 -1
- package/lib/MultiParty/types.d.ts +1 -0
- package/lib/MultiParty/types.d.ts.map +1 -1
- package/lib/MultiParty/types.js +2 -5
- package/lib/MultiParty/types.js.map +1 -1
- package/lib/MultiParty/utils.d.ts +1 -0
- package/lib/MultiParty/utils.d.ts.map +1 -1
- package/lib/MultiParty/utils.js +5 -15
- package/lib/MultiParty/utils.js.map +1 -1
- package/lib/TechseeMediaStream.d.ts +1 -0
- package/lib/TechseeMediaStream.d.ts.map +1 -1
- package/lib/TechseeMediaStream.js +53 -61
- package/lib/TechseeMediaStream.js.map +1 -1
- package/lib/qos/raw-qos.d.ts +29 -0
- package/lib/qos/raw-qos.d.ts.map +1 -0
- package/lib/qos/raw-qos.js +247 -382
- package/lib/qos/raw-qos.js.map +1 -1
- package/lib/webrtc-ie-shim.d.ts +4 -0
- package/lib/webrtc-ie-shim.d.ts.map +1 -0
- package/lib/webrtc-ie-shim.js +1999 -3454
- package/lib/webrtc-ie-shim.js.map +1 -1
- package/package.json +42 -46
package/lib/qos/raw-qos.js
CHANGED
|
@@ -1,394 +1,259 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.RawQos = void 0;
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var RawQos = /*#__PURE__*/function () {
|
|
21
|
-
function RawQos() {
|
|
22
|
-
_classCallCheck(this, RawQos);
|
|
23
|
-
|
|
24
|
-
if (RawQos.instance) {
|
|
25
|
-
return RawQos.instance;
|
|
4
|
+
var RawQos = (function () {
|
|
5
|
+
function RawQos() {
|
|
6
|
+
if (RawQos.instance) {
|
|
7
|
+
return RawQos.instance;
|
|
8
|
+
}
|
|
9
|
+
this.VIDEO_CODECS = ['vp9', 'vp8', 'h264'];
|
|
10
|
+
this.rawQoSEntry = {};
|
|
11
|
+
this.enableRawEntries = true;
|
|
12
|
+
this.bytesPrev = null;
|
|
13
|
+
this.timestampPrev = null;
|
|
14
|
+
this.startTimestamp = null;
|
|
15
|
+
RawQos.instance = this;
|
|
26
16
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
self.rawQoSEntry.remote = {};
|
|
88
|
-
|
|
89
|
-
self._parseOutStats(_remote, self.rawQoSEntry.remote);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
this._parseRelated(stats, stat, self);
|
|
93
|
-
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
case 'remote-inbound-rtp':
|
|
98
|
-
{
|
|
99
|
-
self._addRaw(stat);
|
|
100
|
-
|
|
101
|
-
self.rawQoSEntry.remote = {};
|
|
102
|
-
|
|
103
|
-
self._parseInStats(stat, self.rawQoSEntry.remote);
|
|
104
|
-
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
case 'remote-outbound-rtp':
|
|
109
|
-
{
|
|
110
|
-
self._addRaw(stat);
|
|
111
|
-
|
|
112
|
-
self.rawQoSEntry.remote = {};
|
|
113
|
-
|
|
114
|
-
self._parseOutStats(stat, self.rawQoSEntry.remote);
|
|
115
|
-
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
|
|
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);
|
|
125
|
-
|
|
126
|
-
self._parseServerStats(stat, self.rawQoSEntry.servers, stats);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
case 'track':
|
|
133
|
-
{
|
|
134
|
-
self.track = stat;
|
|
135
|
-
break;
|
|
17
|
+
RawQos.prototype.parse = function (stats) {
|
|
18
|
+
var self = this;
|
|
19
|
+
self.rawQoSEntry = {};
|
|
20
|
+
self._clearRaw();
|
|
21
|
+
for (var _i = 0, _a = stats.values(); _i < _a.length; _i++) {
|
|
22
|
+
var stat = _a[_i];
|
|
23
|
+
if (!stat.isRemote) {
|
|
24
|
+
switch (stat.type) {
|
|
25
|
+
case 'outbound-rtp': {
|
|
26
|
+
self._addRaw(stat);
|
|
27
|
+
self._parseOutStats(stat, self.rawQoSEntry);
|
|
28
|
+
var remote = stats.get(stat.remoteId);
|
|
29
|
+
if (remote) {
|
|
30
|
+
self._addRaw(remote);
|
|
31
|
+
self.rawQoSEntry.remote = {};
|
|
32
|
+
self._parseInStats(remote, self.rawQoSEntry.remote);
|
|
33
|
+
}
|
|
34
|
+
this._parseRelated(stats, stat, self);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case 'inbound-rtp': {
|
|
38
|
+
self._addRaw(stat);
|
|
39
|
+
self._parseInStats(stat, self.rawQoSEntry);
|
|
40
|
+
var remote = stats.get(stat.remoteId);
|
|
41
|
+
if (remote) {
|
|
42
|
+
self._addRaw(remote);
|
|
43
|
+
self.rawQoSEntry.remote = {};
|
|
44
|
+
self._parseOutStats(remote, self.rawQoSEntry.remote);
|
|
45
|
+
}
|
|
46
|
+
this._parseRelated(stats, stat, self);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case 'remote-inbound-rtp': {
|
|
50
|
+
self._addRaw(stat);
|
|
51
|
+
self.rawQoSEntry.remote = {};
|
|
52
|
+
self._parseInStats(stat, self.rawQoSEntry.remote);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case 'remote-outbound-rtp': {
|
|
56
|
+
self._addRaw(stat);
|
|
57
|
+
self.rawQoSEntry.remote = {};
|
|
58
|
+
self._parseOutStats(stat, self.rawQoSEntry.remote);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case 'candidate-pair': {
|
|
62
|
+
if ((stat.bytesSent > 0 || stat.bytesReceived > 0) &&
|
|
63
|
+
(!self.rawQoSEntry.servers ||
|
|
64
|
+
stat.bytesSent > self.rawQoSEntry.servers.bytesSent ||
|
|
65
|
+
stat.bytesReceived > self.rawQoSEntry.servers.bytesReceived)) {
|
|
66
|
+
self.rawQoSEntry.servers = {};
|
|
67
|
+
self._addRaw(stat);
|
|
68
|
+
self._parseServerStats(stat, self.rawQoSEntry.servers, stats);
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case 'track': {
|
|
73
|
+
self.track = stat;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
136
76
|
}
|
|
137
77
|
}
|
|
138
|
-
}
|
|
139
78
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
_iterator.f();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (!self.rawQoSEntry.frameWidth && self.track) {
|
|
147
|
-
self._addRaw(self.track);
|
|
148
|
-
|
|
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 = [];
|
|
79
|
+
if (!self.rawQoSEntry.frameWidth && self.track) {
|
|
80
|
+
self._addRaw(self.track);
|
|
81
|
+
self._parseTrack(self.track, self.rawQoSEntry);
|
|
187
82
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
if (index >= 0) {
|
|
235
|
-
parent.videoCodec = this.VIDEO_CODECS[index];
|
|
83
|
+
self.track = null;
|
|
84
|
+
return self.rawQoSEntry;
|
|
85
|
+
};
|
|
86
|
+
RawQos.prototype._parseRelated = function (stats, stat, self) {
|
|
87
|
+
var track = stats.get(stat.trackId);
|
|
88
|
+
if (track) {
|
|
89
|
+
self._addRaw(track);
|
|
90
|
+
self._parseTrack(track, self.rawQoSEntry);
|
|
236
91
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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);
|
|
306
|
-
|
|
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));
|
|
92
|
+
var codec = stats.get(stat.codecId);
|
|
93
|
+
if (codec) {
|
|
94
|
+
self._addRaw(codec);
|
|
95
|
+
self._parseCodec(codec, self.rawQoSEntry);
|
|
353
96
|
}
|
|
354
|
-
|
|
355
|
-
|
|
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
|
-
}
|
|
97
|
+
};
|
|
98
|
+
RawQos.prototype._clearRaw = function () {
|
|
99
|
+
if (this.enableRawEntries) {
|
|
100
|
+
this.rawQoSEntry.raw = [];
|
|
368
101
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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 += ',';
|
|
102
|
+
};
|
|
103
|
+
RawQos.prototype._addRaw = function (item) {
|
|
104
|
+
if (this.enableRawEntries && item) {
|
|
105
|
+
if (!this.rawQoSEntry.raw) {
|
|
106
|
+
this.rawQoSEntry.raw = [];
|
|
107
|
+
}
|
|
108
|
+
this.rawQoSEntry.raw.push(this._dumpItem(item));
|
|
383
109
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
110
|
+
};
|
|
111
|
+
RawQos.prototype._parseServerStats = function (result, parent, stats) {
|
|
112
|
+
parent.bytesSent = result.bytesSent;
|
|
113
|
+
parent.bytesReceived = result.bytesReceived;
|
|
114
|
+
if (typeof result.totalRoundTripTime === 'number') {
|
|
115
|
+
parent.totalRoundTripTime = result.totalRoundTripTime;
|
|
116
|
+
}
|
|
117
|
+
if (typeof result.currentRoundTripTime === 'number') {
|
|
118
|
+
parent.currentRoundTripTime = result.currentRoundTripTime;
|
|
119
|
+
}
|
|
120
|
+
if (typeof result.availableOutgoingBitrate === 'number') {
|
|
121
|
+
parent.availableOutgoingBitrate = result.availableOutgoingBitrate;
|
|
122
|
+
}
|
|
123
|
+
var localCandidate = stats.get(result.localCandidateId);
|
|
124
|
+
if (localCandidate) {
|
|
125
|
+
this._addRaw(localCandidate);
|
|
126
|
+
this._parseLocal(localCandidate, parent);
|
|
127
|
+
}
|
|
128
|
+
var remoteCandidate = stats.get(result.remoteCandidateId);
|
|
129
|
+
if (remoteCandidate) {
|
|
130
|
+
this._addRaw(remoteCandidate);
|
|
131
|
+
this._parseRemote(remoteCandidate, parent);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
RawQos.prototype._parseCodec = function (result, parent) {
|
|
135
|
+
if (result.mimeType) {
|
|
136
|
+
var index = this.VIDEO_CODECS.findIndex(function (codec) { return result.mimeType.toLowerCase().includes(codec); });
|
|
137
|
+
if (index >= 0) {
|
|
138
|
+
parent.videoCodec = this.VIDEO_CODECS[index];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
RawQos.prototype._parseLocal = function (result, parent) {
|
|
143
|
+
parent.localIP = result.ip || result.ipAddress;
|
|
144
|
+
parent.localPort = result.port || result.portNumber;
|
|
145
|
+
parent.localProtocol = result.protocol || result.transport;
|
|
146
|
+
};
|
|
147
|
+
RawQos.prototype._parseRemote = function (result, parent) {
|
|
148
|
+
parent.remoteIP = result.ip || result.ipAddress;
|
|
149
|
+
parent.remotePort = result.port || result.portNumber;
|
|
150
|
+
parent.remoteProtocol = result.protocol || result.transport;
|
|
151
|
+
};
|
|
152
|
+
RawQos.prototype._parseTrack = function (result, parent) {
|
|
153
|
+
if (typeof result.frameWidth === 'number') {
|
|
154
|
+
parent.frameWidth = result.frameWidth;
|
|
155
|
+
}
|
|
156
|
+
if (typeof result.frameHeight === 'number') {
|
|
157
|
+
parent.frameHeight = result.frameHeight;
|
|
158
|
+
}
|
|
159
|
+
if (typeof result.framesPerSecond === 'number') {
|
|
160
|
+
parent.videoFrameRate = result.framesPerSecond;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
RawQos.prototype._parseOutStats = function (result, parent) {
|
|
164
|
+
parent.isPublisher = true;
|
|
165
|
+
parent.videoSentPackets = result.packetsSent;
|
|
166
|
+
parent.videoSentPacketsLost = result.packetsLost;
|
|
167
|
+
parent.videoSentBytes = result.bytesSent;
|
|
168
|
+
this._parseBitrate(result, parent, parent.videoSentBytes);
|
|
169
|
+
this._parseFrameRate(result, parent, parent.videoSentBytes);
|
|
170
|
+
this._parseOther(result, parent);
|
|
171
|
+
this._saveSomeMetrics(parent, result);
|
|
172
|
+
};
|
|
173
|
+
RawQos.prototype._parseVideoDuration = function (result, parent) {
|
|
174
|
+
if (!this.startTimestamp) {
|
|
175
|
+
this.startTimestamp = result.timestamp;
|
|
176
|
+
}
|
|
177
|
+
parent.videoDuration = ((result.timestamp - this.startTimestamp) / 1000).toFixed(2);
|
|
178
|
+
};
|
|
179
|
+
RawQos.prototype._parseInStats = function (result, parent) {
|
|
180
|
+
parent.isSubscriber = true;
|
|
181
|
+
parent.videoReceivedPackets = result.packetsReceived;
|
|
182
|
+
parent.videoReceivedPacketsLost = result.packetsLost;
|
|
183
|
+
parent.videoReceivedBytes = result.bytesReceived;
|
|
184
|
+
this._parseBitrate(result, parent, parent.videoReceivedBytes);
|
|
185
|
+
this._parseFrameRate(result, parent, parent.videoReceivedBytes);
|
|
186
|
+
this._parseOther(result, parent);
|
|
187
|
+
this._saveSomeMetrics(parent, result);
|
|
188
|
+
};
|
|
189
|
+
RawQos.prototype._saveSomeMetrics = function (parent, result) {
|
|
190
|
+
if (parent === this.rawQoSEntry) {
|
|
191
|
+
this.bytesPrev = parent.videoReceivedBytes;
|
|
192
|
+
this.timestampPrev = result.timestamp;
|
|
193
|
+
this.ssrcPrev = result.ssrc;
|
|
194
|
+
this.framesDecodedPrev = result.framesDecoded;
|
|
195
|
+
this._parseVideoDuration(result, parent);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
RawQos.prototype._parseOther = function (result, parent) {
|
|
199
|
+
parent.timestamp = result.timestamp;
|
|
200
|
+
parent.ssrc = result.ssrc;
|
|
201
|
+
if (typeof result.discardedPackets === 'number') {
|
|
202
|
+
parent.discardedPackets = result.discardedPackets;
|
|
203
|
+
}
|
|
204
|
+
if (typeof result.jitter === 'number') {
|
|
205
|
+
parent.jitter = result.jitter;
|
|
206
|
+
}
|
|
207
|
+
if (typeof result.packetsRepaired === 'number') {
|
|
208
|
+
parent.packetsRepaired = result.packetsRepaired;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
RawQos.prototype._parseBitrate = function (result, parent, bytes) {
|
|
212
|
+
if (bytes > 0) {
|
|
213
|
+
if (typeof result.bitrateMean === 'number') {
|
|
214
|
+
parent.videoBitRate = result.bitrateMean.toFixed(2);
|
|
215
|
+
}
|
|
216
|
+
else if (this.bytesPrev && this.timestampPrev) {
|
|
217
|
+
var totalBytes = bytes;
|
|
218
|
+
if (result.ssrc === this.ssrcPrev && bytes > this.bytesPrev) {
|
|
219
|
+
totalBytes = bytes - this.bytesPrev;
|
|
220
|
+
}
|
|
221
|
+
parent.videoBitRate = Math.floor((8 * totalBytes) / ((result.timestamp - this.timestampPrev) / 1000));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
parent.videoBitRate = 0;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
RawQos.prototype._parseFrameRate = function (result, parent, bytes) {
|
|
229
|
+
if (bytes > 0) {
|
|
230
|
+
if (typeof result.framerateMean === 'number') {
|
|
231
|
+
parent.videoFrameRate = Number(result.framerateMean).toFixed(2);
|
|
232
|
+
}
|
|
233
|
+
else if (this.framesDecodedPrev && this.timestampPrev) {
|
|
234
|
+
if (result.framesDecoded >= this.framesDecodedPrev && result.timestamp > this.timestampPrev) {
|
|
235
|
+
parent.videoFrameRate = ((result.framesDecoded - this.framesDecodedPrev) /
|
|
236
|
+
((result.timestamp - this.timestampPrev) / 1000)).toFixed(2);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
parent.videoFrameRate = 0;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
RawQos.prototype._dumpItem = function (res) {
|
|
245
|
+
var statsString = '{';
|
|
246
|
+
var index = 0;
|
|
247
|
+
Object.keys(res).forEach(function (k) {
|
|
248
|
+
statsString += "\"".concat(k, "\": \"").concat(res[k], "\"");
|
|
249
|
+
if (++index !== res.length) {
|
|
250
|
+
statsString += ',';
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
statsString += '}';
|
|
254
|
+
return statsString;
|
|
255
|
+
};
|
|
256
|
+
return RawQos;
|
|
257
|
+
}());
|
|
393
258
|
exports.RawQos = RawQos;
|
|
394
|
-
//# sourceMappingURL=raw-qos.js.map
|
|
259
|
+
//# sourceMappingURL=raw-qos.js.map
|