@observertc/observer-js 0.42.1 → 0.42.3
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/ObservedCall.d.ts +5 -10
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +17 -22
- package/lib/ObservedClient.d.ts +21 -10
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +98 -33
- package/lib/ObservedInboundAudioTrack.d.ts +2 -0
- package/lib/ObservedInboundAudioTrack.d.ts.map +1 -1
- package/lib/ObservedInboundAudioTrack.js +2 -0
- package/lib/ObservedInboundVideoTrack.d.ts +4 -1
- package/lib/ObservedInboundVideoTrack.d.ts.map +1 -1
- package/lib/ObservedInboundVideoTrack.js +2 -1
- package/lib/ObservedOutboundAudioTrack.d.ts +2 -0
- package/lib/ObservedOutboundAudioTrack.d.ts.map +1 -1
- package/lib/ObservedOutboundAudioTrack.js +2 -12
- package/lib/ObservedOutboundVideoTrack.d.ts +4 -1
- package/lib/ObservedOutboundVideoTrack.d.ts.map +1 -1
- package/lib/ObservedOutboundVideoTrack.js +2 -1
- package/lib/ObservedPeerConnection.d.ts +2 -0
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/Observer.d.ts +0 -2
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +5 -3
- package/lib/common/CalculatedScore.js +3 -3
- package/lib/common/types.d.ts +1 -0
- package/lib/common/types.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ObservedCall.ts +35 -41
- package/src/ObservedClient.ts +120 -42
- package/src/ObservedInboundAudioTrack.ts +8 -0
- package/src/ObservedInboundVideoTrack.ts +10 -1
- package/src/ObservedOutboundAudioTrack.ts +8 -16
- package/src/ObservedOutboundVideoTrack.ts +10 -1
- package/src/ObservedPeerConnection.ts +6 -1
- package/src/Observer.ts +3 -5
- package/src/common/CalculatedScore.ts +1 -1
- package/src/common/types.ts +1 -0
- package/src/index.ts +1 -0
- package/lib/monitors/ClientQualityMonitor.d.ts +0 -1
- package/lib/monitors/ClientQualityMonitor.d.ts.map +0 -1
- package/lib/monitors/ClientQualityMonitor.js +0 -1
- package/src/monitors/ClientQualityMonitor.ts +0 -0
|
@@ -5,6 +5,7 @@ import { InboundAudioTrackReport, InboundVideoTrackReport } from '@observertc/re
|
|
|
5
5
|
import { CalculatedScore, calculateBaseVideoScore } from './common/CalculatedScore';
|
|
6
6
|
import { ClientIssue } from './monitors/CallSummary';
|
|
7
7
|
import { ObservedOutboundVideoTrack } from './ObservedOutboundVideoTrack';
|
|
8
|
+
import { SupportedVideoCodecType } from './common/types';
|
|
8
9
|
|
|
9
10
|
export type ObservedInboundVideoTrackModel = {
|
|
10
11
|
trackId: string;
|
|
@@ -54,8 +55,13 @@ export class ObservedInboundVideoTrack extends EventEmitter {
|
|
|
54
55
|
public readonly created = Date.now();
|
|
55
56
|
public visited = false;
|
|
56
57
|
|
|
58
|
+
// timestamp of the MEDIA_TRACK_ADDED event
|
|
59
|
+
public added?: number;
|
|
60
|
+
// timestamp of the MEDIA_TRACK_REMOVED event
|
|
61
|
+
public removed?: number;
|
|
62
|
+
|
|
57
63
|
public contentType: 'lowmotion' | 'standard' | 'highmotion' = 'standard';
|
|
58
|
-
public codec
|
|
64
|
+
public codec?: SupportedVideoCodecType;
|
|
59
65
|
|
|
60
66
|
private readonly _stats = new Map<number, ObservedInboundVideoTrackStats>();
|
|
61
67
|
|
|
@@ -267,6 +273,9 @@ export class ObservedInboundVideoTrack extends EventEmitter {
|
|
|
267
273
|
this._stats.set(sample.ssrc, stats);
|
|
268
274
|
|
|
269
275
|
this.visited = true;
|
|
276
|
+
// a peer connection is active if it has at least one active track
|
|
277
|
+
this.peerConnection.visited = true;
|
|
278
|
+
|
|
270
279
|
this._updated = now;
|
|
271
280
|
this.emit('update', {
|
|
272
281
|
elapsedTimeInMs,
|
|
@@ -50,6 +50,11 @@ export class ObservedOutboundAudioTrack extends EventEmitter {
|
|
|
50
50
|
public readonly created = Date.now();
|
|
51
51
|
public visited = false;
|
|
52
52
|
|
|
53
|
+
// timestamp of the MEDIA_TRACK_ADDED event
|
|
54
|
+
public added?: number;
|
|
55
|
+
// timestamp of the MEDIA_TRACK_REMOVED event
|
|
56
|
+
public removed?: number;
|
|
57
|
+
|
|
53
58
|
public bitrate = 0;
|
|
54
59
|
public rttInMs?: number;
|
|
55
60
|
public jitter?: number;
|
|
@@ -222,23 +227,10 @@ export class ObservedOutboundAudioTrack extends EventEmitter {
|
|
|
222
227
|
|
|
223
228
|
this._stats.set(sample.ssrc, stats);
|
|
224
229
|
|
|
225
|
-
// this.bitrate = [ ...this._stats.values() ].reduce((acc, stat) => acc + stat.bitrate, 0);
|
|
226
|
-
// this.rttInMs = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.rttInMs ?? 0), 0) / (this._stats.size || 1);
|
|
227
|
-
|
|
228
|
-
// this.totalLostPackets = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.packetsLost ?? 0), 0);
|
|
229
|
-
// this.totalSentPackets = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.packetsSent ?? 0), 0);
|
|
230
|
-
// this.totalSentBytes = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.bytesSent ?? 0), 0);
|
|
231
|
-
// this.totalSentFrames = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.deltaSentPackets ?? 0), 0);
|
|
232
|
-
|
|
233
|
-
// this.deltaEncodedFrames = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.deltaEncodedFrames ?? 0), 0);
|
|
234
|
-
// this.deltaSentFrames = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.deltaSentFrames ?? 0), 0);
|
|
235
|
-
// this.deltaLostPackets = [ ...this._stats.values() ].reduce((acc, stat) => acc + stat.deltaLostPackets, 0);
|
|
236
|
-
// this.deltaSentPackets = [ ...this._stats.values() ].reduce((acc, stat) => acc + stat.deltaSentPackets, 0);
|
|
237
|
-
// this.deltaSentBytes = [ ...this._stats.values() ].reduce((acc, stat) => acc + stat.deltaSentBytes, 0);
|
|
238
|
-
|
|
239
|
-
// setting up sfu connection as it is not always available at the first sample
|
|
240
|
-
|
|
241
230
|
this.visited = true;
|
|
231
|
+
// a peer connection is active if it has at least one active track
|
|
232
|
+
this.peerConnection.visited = true;
|
|
233
|
+
|
|
242
234
|
this._updated = now;
|
|
243
235
|
this.emit('update', {
|
|
244
236
|
elapsedTimeInMs,
|
|
@@ -5,6 +5,7 @@ import { OutboundAudioTrackReport, OutboundVideoTrackReport } from '@observertc/
|
|
|
5
5
|
import { ObservedInboundVideoTrack } from './ObservedInboundVideoTrack';
|
|
6
6
|
import { calculateBaseVideoScore, CalculatedScore } from './common/CalculatedScore';
|
|
7
7
|
import { ClientIssue } from './monitors/CallSummary';
|
|
8
|
+
import { SupportedVideoCodecType } from './common/types';
|
|
8
9
|
|
|
9
10
|
export type ObservedOutboundVideoTrackModel = {
|
|
10
11
|
trackId: string;
|
|
@@ -50,8 +51,13 @@ export class ObservedOutboundVideoTrack extends EventEmitter {
|
|
|
50
51
|
public readonly created = Date.now();
|
|
51
52
|
public visited = false;
|
|
52
53
|
|
|
54
|
+
// timestamp of the MEDIA_TRACK_ADDED event
|
|
55
|
+
public added?: number;
|
|
56
|
+
// timestamp of the MEDIA_TRACK_REMOVED event
|
|
57
|
+
public removed?: number;
|
|
58
|
+
|
|
53
59
|
public contentType: 'lowmotion' | 'standard' | 'highmotion' = 'standard';
|
|
54
|
-
public codec
|
|
60
|
+
public codec?: SupportedVideoCodecType;
|
|
55
61
|
public highestLayer?: ObservedOutboundVideoTrackStats;
|
|
56
62
|
|
|
57
63
|
public bitrate = 0;
|
|
@@ -241,6 +247,9 @@ export class ObservedOutboundVideoTrack extends EventEmitter {
|
|
|
241
247
|
// setting up sfu connection as it is not always available at the first sample
|
|
242
248
|
|
|
243
249
|
this.visited = true;
|
|
250
|
+
// a peer connection is active if it has at least one active track
|
|
251
|
+
this.peerConnection.visited = true;
|
|
252
|
+
|
|
244
253
|
this._updated = now;
|
|
245
254
|
this.emit('update', {
|
|
246
255
|
elapsedTimeInMs,
|
|
@@ -42,7 +42,12 @@ export declare interface ObservedPeerConnection {
|
|
|
42
42
|
export class ObservedPeerConnection extends EventEmitter {
|
|
43
43
|
public readonly created = Date.now();
|
|
44
44
|
public visited = true;
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
// timestamp of the PEER_CONNECTION_OPENED event
|
|
47
|
+
public opened?: number;
|
|
48
|
+
// timestamp of the PEER_CONNECTION_CLOSED event
|
|
49
|
+
public closedTimestamp?: number;
|
|
50
|
+
|
|
46
51
|
private _elapsedTimeSinceLastUpdate?: number;
|
|
47
52
|
private _statsTimestamp?: number;
|
|
48
53
|
|
package/src/Observer.ts
CHANGED
|
@@ -104,7 +104,7 @@ export class Observer extends EventEmitter {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
public createObservedCall<T extends Record<string, unknown> = Record<string, unknown>>(
|
|
107
|
-
config: PartialBy<ObservedCallModel, 'serviceId'> & { appData: T,
|
|
107
|
+
config: PartialBy<ObservedCallModel, 'serviceId'> & { appData: T, reportCallStarted?: boolean, reportCallEnded?: boolean }
|
|
108
108
|
): ObservedCall<T> {
|
|
109
109
|
if (this._closed) {
|
|
110
110
|
throw new Error('Attempted to create a call source on a closed observer');
|
|
@@ -112,8 +112,6 @@ export class Observer extends EventEmitter {
|
|
|
112
112
|
|
|
113
113
|
const {
|
|
114
114
|
appData,
|
|
115
|
-
started = Date.now(),
|
|
116
|
-
ended,
|
|
117
115
|
reportCallEnded = true,
|
|
118
116
|
reportCallStarted = true,
|
|
119
117
|
...model
|
|
@@ -132,7 +130,7 @@ export class Observer extends EventEmitter {
|
|
|
132
130
|
call.serviceId,
|
|
133
131
|
call.roomId,
|
|
134
132
|
call.callId,
|
|
135
|
-
ended ?? Date.now(),
|
|
133
|
+
call.ended ?? Date.now(),
|
|
136
134
|
));
|
|
137
135
|
});
|
|
138
136
|
|
|
@@ -141,7 +139,7 @@ export class Observer extends EventEmitter {
|
|
|
141
139
|
call.serviceId,
|
|
142
140
|
call.roomId,
|
|
143
141
|
call.callId,
|
|
144
|
-
started,
|
|
142
|
+
call.started ?? Date.now(),
|
|
145
143
|
));
|
|
146
144
|
|
|
147
145
|
this.emit('newcall', call);
|
|
@@ -82,7 +82,7 @@ export function calculateBaseVideoScore(track: ObservedInboundVideoTrack | Obser
|
|
|
82
82
|
|
|
83
83
|
const bpp = bitrate / (frameHeight * frameWidth * framesPerSecond);
|
|
84
84
|
// let's assume vp8 for now
|
|
85
|
-
const bppRange = BPP_RANGES[track.contentType][track.codec];
|
|
85
|
+
const bppRange = BPP_RANGES[track.contentType][track.codec ?? 'vp8'];
|
|
86
86
|
|
|
87
87
|
if (bpp / 2 < bppRange.low) {
|
|
88
88
|
score.score = 1.0;
|
package/src/common/types.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=ClientQualityMonitor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientQualityMonitor.d.ts","sourceRoot":"","sources":["../../src/monitors/ClientQualityMonitor.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
File without changes
|