New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@observertc/observer-js

Package Overview
Dependencies
Maintainers
2
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@observertc/observer-js - npm Package Compare versions

Comparing version 0.30.1-beta to 0.30.2-beta

lib/common/CallEventType.d.ts

10

lib/common/callEventReports.d.ts
import { CallEventReport } from '@observertc/report-schemas-js';
export declare enum CallEventType {
CALL_STARTED = "CALL_STARTED",
CALL_ENDED = "CALL_ENDED",
CLIENT_JOINED = "CLIENT_JOINED",
CLIENT_LEFT = "CLIENT_LEFT",
PEER_CONNECTION_OPENED = "PEER_CONNECTION_OPENED",
PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED",
MEDIA_TRACK_ADDED = "MEDIA_TRACK_ADDED",
MEDIA_TRACK_REMOVED = "MEDIA_TRACK_REMOVED"
}
export declare function createCallStartedEventReport(serviceId: string, roomId: string, callId: string, timestamp: number, marker?: string): CallEventReport;

@@ -13,0 +3,0 @@ export declare function createCallEndedEventReport(serviceId: string, roomId: string, callId: string, timestamp: number, marker?: string): CallEventReport;

31

lib/common/callEventReports.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createMediaTrackRemovedEventReport = exports.createMediaTrackAddedEventReport = exports.createPeerConnectionClosedEventReport = exports.createPeerConnectionOpenedEventReport = exports.createClientLeftEventReport = exports.createClientJoinedEventReport = exports.createCallEndedEventReport = exports.createCallStartedEventReport = exports.CallEventType = void 0;
// eslint-disable-next-line no-shadow
var CallEventType;
(function (CallEventType) {
CallEventType["CALL_STARTED"] = "CALL_STARTED";
CallEventType["CALL_ENDED"] = "CALL_ENDED";
CallEventType["CLIENT_JOINED"] = "CLIENT_JOINED";
CallEventType["CLIENT_LEFT"] = "CLIENT_LEFT";
CallEventType["PEER_CONNECTION_OPENED"] = "PEER_CONNECTION_OPENED";
CallEventType["PEER_CONNECTION_CLOSED"] = "PEER_CONNECTION_CLOSED";
CallEventType["MEDIA_TRACK_ADDED"] = "MEDIA_TRACK_ADDED";
CallEventType["MEDIA_TRACK_REMOVED"] = "MEDIA_TRACK_REMOVED";
})(CallEventType = exports.CallEventType || (exports.CallEventType = {}));
exports.createMediaTrackRemovedEventReport = exports.createMediaTrackAddedEventReport = exports.createPeerConnectionClosedEventReport = exports.createPeerConnectionOpenedEventReport = exports.createClientLeftEventReport = exports.createClientJoinedEventReport = exports.createCallEndedEventReport = exports.createCallStartedEventReport = void 0;
const CallEventType_1 = require("./CallEventType");
function createCallStartedEventReport(serviceId, roomId, callId, timestamp, marker) {
return {
name: CallEventType.CALL_STARTED,
name: CallEventType_1.CallEventType.CALL_STARTED,
serviceId,

@@ -29,3 +18,3 @@ roomId,

return {
name: CallEventType.CALL_ENDED,
name: CallEventType_1.CallEventType.CALL_ENDED,
serviceId,

@@ -41,3 +30,3 @@ roomId,

return {
name: CallEventType.CLIENT_JOINED,
name: CallEventType_1.CallEventType.CLIENT_JOINED,
serviceId,

@@ -56,3 +45,3 @@ mediaUnitId,

return {
name: CallEventType.CLIENT_LEFT,
name: CallEventType_1.CallEventType.CLIENT_LEFT,
serviceId,

@@ -71,3 +60,3 @@ mediaUnitId,

return {
name: CallEventType.PEER_CONNECTION_OPENED,
name: CallEventType_1.CallEventType.PEER_CONNECTION_OPENED,
serviceId,

@@ -86,3 +75,3 @@ mediaUnitId,

return {
name: CallEventType.PEER_CONNECTION_CLOSED,
name: CallEventType_1.CallEventType.PEER_CONNECTION_CLOSED,
serviceId,

@@ -101,3 +90,3 @@ mediaUnitId,

return {
name: CallEventType.MEDIA_TRACK_ADDED,
name: CallEventType_1.CallEventType.MEDIA_TRACK_ADDED,
serviceId,

@@ -117,3 +106,3 @@ mediaUnitId,

return {
name: CallEventType.MEDIA_TRACK_REMOVED,
name: CallEventType_1.CallEventType.MEDIA_TRACK_REMOVED,
serviceId,

@@ -120,0 +109,0 @@ mediaUnitId,

import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto2 } from "@bufbuild/protobuf";
import { Samples_ClientSample_Browser, Samples_ClientSample_Engine, Samples_ClientSample_IceCandidatePair, Samples_ClientSample_IceLocalCandidate, Samples_ClientSample_IceRemoteCandidate, Samples_ClientSample_InboundAudioTrack, Samples_ClientSample_InboundVideoTrack, Samples_ClientSample_OperationSystem, Samples_ClientSample_OutboundAudioTrack, Samples_ClientSample_OutboundVideoTrack, Samples_ClientSample_PeerConnectionTransport, Samples_ClientSample_Platform } from "./samples_pb";
import { Samples_ClientSample_Browser, Samples_ClientSample_Engine, Samples_ClientSample_OperationSystem, Samples_ClientSample_Platform } from "./samples_pb";
/**

@@ -38,23 +38,2 @@ * @generated from message org.observertc.observer.models.Call

/**
* @generated from message org.observertc.observer.models.ClientCoordinate
*/
export declare class ClientCoordinate extends Message<ClientCoordinate> {
/**
* @generated from field: required float latitude = 1;
*/
latitude?: number;
/**
* @generated from field: required float longitude = 2;
*/
longitude?: number;
constructor(data?: PartialMessage<ClientCoordinate>);
static readonly runtime: typeof proto2;
static readonly typeName = "org.observertc.observer.models.ClientCoordinate";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ClientCoordinate;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ClientCoordinate;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ClientCoordinate;
static equals(a: ClientCoordinate | PlainMessage<ClientCoordinate> | undefined, b: ClientCoordinate | PlainMessage<ClientCoordinate> | undefined): boolean;
}
/**
* @generated from message org.observertc.observer.models.Client

@@ -123,14 +102,2 @@ */

engine?: Samples_ClientSample_Engine;
/**
* message Stats {
* optional double maxRttInS = 1;
* optional double minRttInS = 2;
* optional string location = 3;
* }
*
* optional Stats stats = 13;
*
* @generated from field: optional org.observertc.observer.models.ClientCoordinate coordinates = 16;
*/
coordinates?: ClientCoordinate;
constructor(data?: PartialMessage<Client>);

@@ -198,18 +165,2 @@ static readonly runtime: typeof proto2;

/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceLocalCandidate icelocalCandidates = 13;
*/
icelocalCandidates: Samples_ClientSample_IceLocalCandidate[];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceRemoteCandidate iceRemoteCandidates = 14;
*/
iceRemoteCandidates: Samples_ClientSample_IceRemoteCandidate[];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceCandidatePair iceCandidatePairs = 15;
*/
iceCandidatePairs: Samples_ClientSample_IceCandidatePair[];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.PeerConnectionTransport transports = 16;
*/
transports: Samples_ClientSample_PeerConnectionTransport[];
/**
* @generated from field: optional uint64 touched = 17;

@@ -236,9 +187,7 @@ */

/**
* optional org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack sample = 4;
*
* @generated from field: optional float fps = 2;
*/
fps?: number;
/**
* @generated from field: optional org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack sample = 4;
*/
sample?: Samples_ClientSample_InboundVideoTrack;
constructor(data?: PartialMessage<InboundTrackVideoStats>);

@@ -339,10 +288,2 @@ static readonly runtime: typeof proto2;

/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundAudioTrack audioStats = 15;
*/
audioStats: Samples_ClientSample_InboundAudioTrack[];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack videoStats = 16;
*/
videoStats: Samples_ClientSample_InboundVideoTrack[];
/**
* @generated from field: optional uint64 touched = 17;

@@ -417,10 +358,2 @@ */

/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.OutboundAudioTrack audioStats = 14;
*/
audioStats: Samples_ClientSample_OutboundAudioTrack[];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.OutboundVideoTrack videoStats = 15;
*/
videoStats: Samples_ClientSample_OutboundVideoTrack[];
/**
* @generated from field: optional uint64 touched = 16;

@@ -427,0 +360,0 @@ */

"use strict";
// @generated by protoc-gen-es v1.1.1 with parameter "target=ts"
// @generated by protoc-gen-es v1.7.2 with parameter "target=ts"
// @generated from file models.proto (package org.observertc.observer.models, syntax proto2)

@@ -7,3 +7,3 @@ /* eslint-disable */

Object.defineProperty(exports, "__esModule", { value: true });
exports.SfuSctpChannel = exports.SfuOutboundRtpPad = exports.SfuInboundRtpPad = exports.SfuTransport = exports.Sfu = exports.OutboundTrack = exports.InboundTrack = exports.InboundTrackStats = exports.InboundTrackVideoStats = exports.PeerConnection = exports.Client = exports.ClientCoordinate = exports.Call = void 0;
exports.SfuSctpChannel = exports.SfuOutboundRtpPad = exports.SfuInboundRtpPad = exports.SfuTransport = exports.Sfu = exports.OutboundTrack = exports.InboundTrack = exports.InboundTrackStats = exports.InboundTrackVideoStats = exports.PeerConnection = exports.Client = exports.Call = void 0;
const protobuf_1 = require("@bufbuild/protobuf");

@@ -47,30 +47,2 @@ const samples_pb_1 = require("./samples_pb");

/**
* @generated from message org.observertc.observer.models.ClientCoordinate
*/
class ClientCoordinate extends protobuf_1.Message {
constructor(data) {
super();
protobuf_1.proto2.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new ClientCoordinate().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new ClientCoordinate().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new ClientCoordinate().fromJsonString(jsonString, options);
}
static equals(a, b) {
return protobuf_1.proto2.util.equals(ClientCoordinate, a, b);
}
}
exports.ClientCoordinate = ClientCoordinate;
ClientCoordinate.runtime = protobuf_1.proto2;
ClientCoordinate.typeName = "org.observertc.observer.models.ClientCoordinate";
ClientCoordinate.fields = protobuf_1.proto2.util.newFieldList(() => [
{ no: 1, name: "latitude", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
{ no: 2, name: "longitude", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
]);
/**
* @generated from message org.observertc.observer.models.Client

@@ -119,3 +91,2 @@ */

{ no: 15, name: "engine", kind: "message", T: samples_pb_1.Samples_ClientSample_Engine, opt: true },
{ no: 16, name: "coordinates", kind: "message", T: ClientCoordinate, opt: true },
]);

@@ -136,18 +107,2 @@ /**

this.outboundTrackIds = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceLocalCandidate icelocalCandidates = 13;
*/
this.icelocalCandidates = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceRemoteCandidate iceRemoteCandidates = 14;
*/
this.iceRemoteCandidates = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceCandidatePair iceCandidatePairs = 15;
*/
this.iceCandidatePairs = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.PeerConnectionTransport transports = 16;
*/
this.transports = [];
protobuf_1.proto2.util.initPartial(data, this);

@@ -184,6 +139,2 @@ }

{ no: 12, name: "outboundTrackIds", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
{ no: 13, name: "icelocalCandidates", kind: "message", T: samples_pb_1.Samples_ClientSample_IceLocalCandidate, repeated: true },
{ no: 14, name: "iceRemoteCandidates", kind: "message", T: samples_pb_1.Samples_ClientSample_IceRemoteCandidate, repeated: true },
{ no: 15, name: "iceCandidatePairs", kind: "message", T: samples_pb_1.Samples_ClientSample_IceCandidatePair, repeated: true },
{ no: 16, name: "transports", kind: "message", T: samples_pb_1.Samples_ClientSample_PeerConnectionTransport, repeated: true },
{ no: 17, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },

@@ -218,3 +169,2 @@ ]);

{ no: 2, name: "fps", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true },
{ no: 4, name: "sample", kind: "message", T: samples_pb_1.Samples_ClientSample_InboundVideoTrack, opt: true },
]);

@@ -260,10 +210,2 @@ /**

this.ssrc = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundAudioTrack audioStats = 15;
*/
this.audioStats = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack videoStats = 16;
*/
this.videoStats = [];
protobuf_1.proto2.util.initPartial(data, this);

@@ -302,4 +244,2 @@ }

{ no: 14, name: "ssrc", kind: "scalar", T: 3 /* ScalarType.INT64 */, repeated: true },
{ no: 15, name: "audioStats", kind: "message", T: samples_pb_1.Samples_ClientSample_InboundAudioTrack, repeated: true },
{ no: 16, name: "videoStats", kind: "message", T: samples_pb_1.Samples_ClientSample_InboundVideoTrack, repeated: true },
{ no: 17, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },

@@ -317,10 +257,2 @@ ]);

this.ssrc = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.OutboundAudioTrack audioStats = 14;
*/
this.audioStats = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.OutboundVideoTrack videoStats = 15;
*/
this.videoStats = [];
protobuf_1.proto2.util.initPartial(data, this);

@@ -358,4 +290,2 @@ }

{ no: 13, name: "ssrc", kind: "scalar", T: 3 /* ScalarType.INT64 */, repeated: true },
{ no: 14, name: "audioStats", kind: "message", T: samples_pb_1.Samples_ClientSample_OutboundAudioTrack, repeated: true },
{ no: 15, name: "videoStats", kind: "message", T: samples_pb_1.Samples_ClientSample_OutboundVideoTrack, repeated: true },
{ no: 16, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },

@@ -362,0 +292,0 @@ ]);

/// <reference types="node" />
import { ClientSample, IceLocalCandidate } from '@observertc/sample-schemas-js';
import { ClientSample } from '@observertc/sample-schemas-js';
import { ObservedCall } from './ObservedCall';

@@ -24,3 +24,2 @@ import { StorageProvider } from './storages/StorageProvider';

'processing-sample-overflow': [];
'candidate-pair-change': [];
newpeerconnection: [ObservedPeerConnection];

@@ -48,6 +47,31 @@ };

private _processingSample;
private _selectedLocalIceCandidate?;
private _selectedRemoteIceCandidate?;
private _timeZoneOffsetInHours?;
private _leaveReported;
totalInboundPacketsLost: number;
totalInboundPacketsReceived: number;
totalOutboundPacketsLost: number;
totalOutboundPacketsReceived: number;
totalOutboundPacketsSent: number;
totalDataChannelBytesSent: number;
totalDataChannelBytesReceived: number;
totalSentAudioBytes: number;
totalSentVideoBytes: number;
totalReceivedAudioBytes: number;
totalReceivedVideoBytes: number;
deltaInboundPacketsLost?: number;
deltaInboundPacketsReceived?: number;
deltaOutboundPacketsLost?: number;
deltaOutboundPacketsReceived?: number;
deltaOutboundPacketsSent?: number;
deltaDataChannelBytesSent?: number;
deltaDataChannelBytesReceived?: number;
deltaReceivedAudioBytes?: number;
deltaReceivedVideoBytes?: number;
deltaSentAudioBytes?: number;
deltaSentVideoBytes?: number;
avgRttInS?: number;
sendingAudioBitrate?: number;
sendingVideoBitrate?: number;
receivingAudioBitrate?: number;
receivingVideoBitrate?: number;
readonly mediaDevices: string[];

@@ -65,4 +89,2 @@ readonly codecs: string[];

get userId(): string | undefined;
get selectedLocalIceCandidate(): IceLocalCandidate | undefined;
get selectedRemoteIceCandidate(): IceLocalCandidate | undefined;
get timeZoneOffsetInHours(): number | undefined;

@@ -69,0 +91,0 @@ get marker(): string | undefined;

@@ -57,2 +57,3 @@ "use strict";

const callEventReports_1 = require("./common/callEventReports");
const CallEventType_1 = require("./common/CallEventType");
const logger = (0, logger_1.createLogger)('ObservedClient');

@@ -99,2 +100,13 @@ class ObservedClient extends events_1.EventEmitter {

this._leaveReported = false;
this.totalInboundPacketsLost = 0;
this.totalInboundPacketsReceived = 0;
this.totalOutboundPacketsLost = 0;
this.totalOutboundPacketsReceived = 0;
this.totalOutboundPacketsSent = 0;
this.totalDataChannelBytesSent = 0;
this.totalDataChannelBytesReceived = 0;
this.totalSentAudioBytes = 0;
this.totalSentVideoBytes = 0;
this.totalReceivedAudioBytes = 0;
this.totalReceivedVideoBytes = 0;
this.mediaDevices = [];

@@ -134,8 +146,2 @@ this.codecs = [];

}
get selectedLocalIceCandidate() {
return this._selectedLocalIceCandidate;
}
get selectedRemoteIceCandidate() {
return this._selectedRemoteIceCandidate;
}
get timeZoneOffsetInHours() {

@@ -193,3 +199,3 @@ return this._timeZoneOffsetInHours;

return this._execute(() => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
let executeSave = false;

@@ -277,9 +283,22 @@ if (this.userId !== sample.userId) {

}
for (let _17 of (_p = sample.customCallEvents) !== null && _p !== void 0 ? _p : []) {
const { timestamp = Date.now() } = _17, callEvent = __rest(_17, ["timestamp"]);
if (callEvent.name === 'CLIENT_LEFT')
this._leaveReported = true;
for (let _16 of (_p = sample.customCallEvents) !== null && _p !== void 0 ? _p : []) {
const { timestamp = Date.now() } = _16, callEvent = __rest(_16, ["timestamp"]);
const peerConnection = this._peerConnections.get((_q = callEvent.peerConnectionId) !== null && _q !== void 0 ? _q : '');
switch (callEvent.name) {
case CallEventType_1.CallEventType.CLIENT_LEFT:
this._leaveReported = true;
break;
case CallEventType_1.CallEventType.ICE_CONNECTION_STATE_CHANGED:
peerConnection && callEvent.value && peerConnection.emit('iceconnectionstatechange', callEvent.value);
break;
case CallEventType_1.CallEventType.ICE_GATHERING_STATE_CHANGED:
peerConnection && callEvent.value && peerConnection.emit('icegatheringstatechange', callEvent.value);
break;
case CallEventType_1.CallEventType.PEER_CONNECTION_STATE_CHANGED:
peerConnection && callEvent.value && peerConnection.emit('connectionstatechange', callEvent.value);
break;
}
this.reports.addCallEventReport(Object.assign({ serviceId: this.serviceId, mediaUnitId: this.mediaUnitId, roomId: this.roomId, callId: this.callId, clientId: this.clientId, userId: this.userId, timestamp }, callEvent));
}
for (const userMediaError of (_q = sample.userMediaErrors) !== null && _q !== void 0 ? _q : []) {
for (const userMediaError of (_r = sample.userMediaErrors) !== null && _r !== void 0 ? _r : []) {
const callMetaReport = (0, callMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {

@@ -292,3 +311,3 @@ type: callMetaReports_1.CallMetaType.USER_MEDIA_ERROR,

}
for (const certificate of (_r = sample.certificates) !== null && _r !== void 0 ? _r : []) {
for (const certificate of (_s = sample.certificates) !== null && _s !== void 0 ? _s : []) {
const callMetaReport = (0, callMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {

@@ -300,3 +319,3 @@ type: callMetaReports_1.CallMetaType.CERTIFICATE,

}
for (const codec of (_s = sample.codecs) !== null && _s !== void 0 ? _s : []) {
for (const codec of (_t = sample.codecs) !== null && _t !== void 0 ? _t : []) {
const callMetaReport = (0, callMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {

@@ -309,3 +328,3 @@ type: callMetaReports_1.CallMetaType.CODEC,

}
for (const iceServer of (_t = sample.iceServers) !== null && _t !== void 0 ? _t : []) {
for (const iceServer of (_u = sample.iceServers) !== null && _u !== void 0 ? _u : []) {
const callMetaReport = (0, callMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {

@@ -317,3 +336,3 @@ type: callMetaReports_1.CallMetaType.ICE_SERVER,

}
for (const mediaDevice of (_u = sample.mediaDevices) !== null && _u !== void 0 ? _u : []) {
for (const mediaDevice of (_v = sample.mediaDevices) !== null && _v !== void 0 ? _v : []) {
const callMetaReport = (0, callMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {

@@ -326,3 +345,3 @@ type: callMetaReports_1.CallMetaType.MEDIA_DEVICE,

}
for (const mediaSource of (_v = sample.mediaSources) !== null && _v !== void 0 ? _v : []) {
for (const mediaSource of (_w = sample.mediaSources) !== null && _w !== void 0 ? _w : []) {
const callMetaReport = (0, callMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {

@@ -334,44 +353,5 @@ type: callMetaReports_1.CallMetaType.MEDIA_SOURCE,

}
let selectedLocalCandidateId;
let selectedRemoteCandidateId;
for (const candidatePair of (_w = sample.iceCandidatePairs) !== null && _w !== void 0 ? _w : []) {
if (candidatePair.nominated) {
if (!selectedLocalCandidateId)
selectedLocalCandidateId = candidatePair.localCandidateId;
if (!selectedRemoteCandidateId)
selectedRemoteCandidateId = candidatePair.remoteCandidateId;
}
const report = Object.assign(Object.assign({ serviceId: this.serviceId, mediaUnitId: this.mediaUnitId, roomId: this.roomId, callId: this.callId, clientId: this.clientId, userId: this.userId, timestamp: sample.timestamp }, candidatePair), { sampleSeq: -1 });
this.reports.addIceCandidatePairReport(report);
}
let changeIceCandidatePair = false;
for (const iceLocalCandidate of (_x = sample.iceLocalCandidates) !== null && _x !== void 0 ? _x : []) {
if (iceLocalCandidate.id && selectedLocalCandidateId &&
iceLocalCandidate.id === selectedLocalCandidateId &&
((_y = this._selectedLocalIceCandidate) === null || _y === void 0 ? void 0 : _y.id) !== iceLocalCandidate.id) {
this._selectedLocalIceCandidate = iceLocalCandidate;
changeIceCandidatePair = true;
}
const callMetaReport = (0, callMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {
type: callMetaReports_1.CallMetaType.ICE_LOCAL_CANDIDATE,
payload: iceLocalCandidate,
}, this.userId);
this.reports.addCallMetaReport(callMetaReport);
}
for (const iceRemoteCandidate of (_z = sample.iceRemoteCandidates) !== null && _z !== void 0 ? _z : []) {
if (iceRemoteCandidate.id && selectedRemoteCandidateId &&
iceRemoteCandidate.id === selectedRemoteCandidateId &&
((_0 = this._selectedRemoteIceCandidate) === null || _0 === void 0 ? void 0 : _0.id) !== iceRemoteCandidate.id) {
this._selectedRemoteIceCandidate = iceRemoteCandidate;
changeIceCandidatePair = true;
}
const callMetaReport = (0, callMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {
type: callMetaReports_1.CallMetaType.ICE_REMOTE_CANDIDATE,
payload: iceRemoteCandidate,
}, this.userId);
this.reports.addCallMetaReport(callMetaReport);
}
for (const transport of (_1 = sample.pcTransports) !== null && _1 !== void 0 ? _1 : []) {
for (const transport of (_x = sample.pcTransports) !== null && _x !== void 0 ? _x : []) {
try {
const peerConnection = (_2 = this._peerConnections.get(transport.transportId)) !== null && _2 !== void 0 ? _2 : yield this._createPeerConnection(transport.peerConnectionId);
const peerConnection = (_y = this._peerConnections.get(transport.transportId)) !== null && _y !== void 0 ? _y : yield this._createPeerConnection(transport.peerConnectionId);
peerConnection.update(transport, sample.timestamp);

@@ -383,3 +363,3 @@ }

}
for (const track of (_3 = sample.inboundAudioTracks) !== null && _3 !== void 0 ? _3 : []) {
for (const track of (_z = sample.inboundAudioTracks) !== null && _z !== void 0 ? _z : []) {
if (!track.peerConnectionId || !track.trackId) {

@@ -390,6 +370,6 @@ logger.warn(`InboundAudioTrack without peerConnectionId or trackId: ${JSON.stringify(track)}`);

try {
const peerConnection = (_4 = this._peerConnections.get(track.peerConnectionId)) !== null && _4 !== void 0 ? _4 : yield this._createPeerConnection(track.peerConnectionId);
const peerConnection = (_0 = this._peerConnections.get(track.peerConnectionId)) !== null && _0 !== void 0 ? _0 : yield this._createPeerConnection(track.peerConnectionId);
if (!peerConnection)
continue;
const inboundAudioTrack = (_5 = peerConnection.inboundAudioTracks.get(track.trackId)) !== null && _5 !== void 0 ? _5 : yield peerConnection.createInboundAudioTrack({
const inboundAudioTrack = (_1 = peerConnection.inboundAudioTracks.get(track.trackId)) !== null && _1 !== void 0 ? _1 : yield peerConnection.createInboundAudioTrack({
trackId: track.trackId,

@@ -400,3 +380,3 @@ sfuStreamId: track.sfuStreamId,

yield inboundAudioTrack.update(track, sample.timestamp);
const remoteOutboundTrack = this.call.sfuStreamIdToOutboundAudioTrack.get((_6 = track.sfuStreamId) !== null && _6 !== void 0 ? _6 : '');
const remoteOutboundTrack = this.call.sfuStreamIdToOutboundAudioTrack.get((_2 = track.sfuStreamId) !== null && _2 !== void 0 ? _2 : '');
if (remoteOutboundTrack && inboundAudioTrack.sfuStreamId && !remoteOutboundTrack.remoteInboundTracks.has(inboundAudioTrack.sfuStreamId)) {

@@ -410,3 +390,3 @@ remoteOutboundTrack.connectInboundTrack(inboundAudioTrack);

}
for (const track of (_7 = sample.inboundVideoTracks) !== null && _7 !== void 0 ? _7 : []) {
for (const track of (_3 = sample.inboundVideoTracks) !== null && _3 !== void 0 ? _3 : []) {
if (!track.peerConnectionId || !track.trackId) {

@@ -424,6 +404,6 @@ logger.warn(`InboundVideoTrack without peerConnectionId or trackId: ${JSON.stringify(track)}`);

try {
const peerConnection = (_8 = this._peerConnections.get(track.peerConnectionId)) !== null && _8 !== void 0 ? _8 : yield this._createPeerConnection(track.peerConnectionId);
const peerConnection = (_4 = this._peerConnections.get(track.peerConnectionId)) !== null && _4 !== void 0 ? _4 : yield this._createPeerConnection(track.peerConnectionId);
if (!peerConnection)
continue;
const inboundVideoTrack = (_9 = peerConnection.inboundVideoTracks.get(track.trackId)) !== null && _9 !== void 0 ? _9 : yield peerConnection.createInboundVideoTrack({
const inboundVideoTrack = (_5 = peerConnection.inboundVideoTracks.get(track.trackId)) !== null && _5 !== void 0 ? _5 : yield peerConnection.createInboundVideoTrack({
trackId: track.trackId,

@@ -434,3 +414,3 @@ sfuStreamId: track.sfuStreamId,

yield inboundVideoTrack.update(track, sample.timestamp);
const remoteOutboundTrack = this.call.sfuStreamIdToOutboundVideoTrack.get((_10 = inboundVideoTrack.sfuStreamId) !== null && _10 !== void 0 ? _10 : '');
const remoteOutboundTrack = this.call.sfuStreamIdToOutboundVideoTrack.get((_6 = inboundVideoTrack.sfuStreamId) !== null && _6 !== void 0 ? _6 : '');
if (remoteOutboundTrack && inboundVideoTrack.sfuStreamId && !remoteOutboundTrack.remoteInboundTracks.has(inboundVideoTrack.sfuStreamId)) {

@@ -444,3 +424,3 @@ remoteOutboundTrack.connectInboundTrack(inboundVideoTrack);

}
for (const track of (_11 = sample.outboundAudioTracks) !== null && _11 !== void 0 ? _11 : []) {
for (const track of (_7 = sample.outboundAudioTracks) !== null && _7 !== void 0 ? _7 : []) {
if (!track.peerConnectionId || !track.trackId) {

@@ -451,6 +431,6 @@ logger.warn(`OutboundAudioTrack without peerConnectionId or trackId: ${JSON.stringify(track)}`);

try {
const peerConnection = (_12 = this._peerConnections.get(track.peerConnectionId)) !== null && _12 !== void 0 ? _12 : yield this._createPeerConnection(track.peerConnectionId);
const peerConnection = (_8 = this._peerConnections.get(track.peerConnectionId)) !== null && _8 !== void 0 ? _8 : yield this._createPeerConnection(track.peerConnectionId);
if (!peerConnection)
continue;
const outboundAudioTrack = (_13 = peerConnection.outboundAudioTracks.get(track.trackId)) !== null && _13 !== void 0 ? _13 : yield peerConnection.createOutboundAudioTrack({
const outboundAudioTrack = (_9 = peerConnection.outboundAudioTracks.get(track.trackId)) !== null && _9 !== void 0 ? _9 : yield peerConnection.createOutboundAudioTrack({
trackId: track.trackId,

@@ -465,3 +445,3 @@ sfuStreamId: track.sfuStreamId,

}
for (const track of (_14 = sample.outboundVideoTracks) !== null && _14 !== void 0 ? _14 : []) {
for (const track of (_10 = sample.outboundVideoTracks) !== null && _10 !== void 0 ? _10 : []) {
if (!track.peerConnectionId || !track.trackId) {

@@ -472,6 +452,6 @@ logger.warn(`OutboundVideoTrack without peerConnectionId or trackId: ${JSON.stringify(track)}`);

try {
const peerConnection = (_15 = this._peerConnections.get(track.peerConnectionId)) !== null && _15 !== void 0 ? _15 : yield this._createPeerConnection(track.peerConnectionId);
const peerConnection = (_11 = this._peerConnections.get(track.peerConnectionId)) !== null && _11 !== void 0 ? _11 : yield this._createPeerConnection(track.peerConnectionId);
if (!peerConnection)
continue;
const outboundVideoTrack = (_16 = peerConnection.outboundVideoTracks.get(track.trackId)) !== null && _16 !== void 0 ? _16 : yield peerConnection.createOutboundVideoTrack({
const outboundVideoTrack = (_12 = peerConnection.outboundVideoTracks.get(track.trackId)) !== null && _12 !== void 0 ? _12 : yield peerConnection.createOutboundVideoTrack({
trackId: track.trackId,

@@ -486,2 +466,34 @@ sfuStreamId: track.sfuStreamId,

}
for (const iceLocalCandidate of (_13 = sample.iceLocalCandidates) !== null && _13 !== void 0 ? _13 : []) {
if (!iceLocalCandidate.peerConnectionId) {
logger.warn(`Local ice candidate without peerConnectionId: ${JSON.stringify(iceLocalCandidate)}`);
continue;
}
const peerConnection = this._peerConnections.get(iceLocalCandidate.peerConnectionId);
if (!peerConnection) {
logger.debug(`Peer connection ${iceLocalCandidate.peerConnectionId} not found for ice local candidate ${iceLocalCandidate.id}`);
continue;
}
peerConnection.ICE.addLocalCandidate(iceLocalCandidate);
}
for (const iceRemoteCandidate of (_14 = sample.iceRemoteCandidates) !== null && _14 !== void 0 ? _14 : []) {
if (!iceRemoteCandidate.peerConnectionId) {
logger.warn(`Remote ice candidate without peerConnectionId: ${JSON.stringify(iceRemoteCandidate)}`);
continue;
}
const peerConnection = this._peerConnections.get(iceRemoteCandidate.peerConnectionId);
if (!peerConnection) {
logger.debug(`Peer connection ${iceRemoteCandidate.peerConnectionId} not found for ice remote candidate ${iceRemoteCandidate.id}`);
continue;
}
peerConnection.ICE.addRemoteCandidate(iceRemoteCandidate);
}
for (const candidatePair of (_15 = sample.iceCandidatePairs) !== null && _15 !== void 0 ? _15 : []) {
const peerConnection = this._peerConnections.get(candidatePair.peerConnectionId);
if (!peerConnection) {
logger.debug(`Peer connection ${candidatePair.peerConnectionId} not found for ice candidate pair ${candidatePair.localCandidateId}, ${candidatePair.remoteCandidateId}`);
continue;
}
peerConnection.ICE.update(candidatePair, sample.timestamp);
}
// close entries that are idle for too long

@@ -515,5 +527,2 @@ if (this.call.observer.config.maxEntryIdleTimeInMs && this._updated < sample.timestamp) {

}
if (changeIceCandidatePair) {
this.emit('candidate-pair-change');
}
if (executeSave)

@@ -520,0 +529,0 @@ yield this._save();

@@ -25,2 +25,10 @@ /// <reference types="node" />

rttInMs?: number;
lostPackets?: number;
receivedPackets?: number;
receivedFrames?: number;
decodedFrames?: number;
droppedFrames?: number;
receivedSamples?: number;
silentConcealedSamples?: number;
fractionLoss?: number;
};

@@ -46,2 +54,10 @@ export declare interface ObservedInboundTrack<Kind extends MediaKind> {

rttInMs: number;
lostPackets: number;
receivedPackets: number;
receivedFrames: number;
decodedFrames: number;
droppedFrames: number;
receivedSamples: number;
silentConcealedSamples: number;
fractionLoss: number;
private constructor();

@@ -48,0 +64,0 @@ get serviceId(): string;

@@ -71,2 +71,10 @@ "use strict";

this.rttInMs = -1;
this.lostPackets = 0;
this.receivedPackets = 0;
this.receivedFrames = 0;
this.decodedFrames = 0;
this.droppedFrames = 0;
this.receivedSamples = 0;
this.silentConcealedSamples = 0;
this.fractionLoss = 0;
}

@@ -148,3 +156,3 @@ get serviceId() {

update(sample, timestamp) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
return __awaiter(this, void 0, void 0, function* () {

@@ -174,8 +182,37 @@ if (this._closed)

const fractionLost = 0 < receivedPackets && 0 < lostPackets ? (lostPackets / (receivedPackets + lostPackets)) : 0;
let decodedFrames;
let droppedFrames;
let receivedFrames;
let silentConcealedSamples;
if (this.kind === 'video') {
const videoSample = sample;
const lastVideoStat = lastStat;
decodedFrames = ((_g = videoSample.framesDecoded) !== null && _g !== void 0 ? _g : 0) - ((_h = lastVideoStat === null || lastVideoStat === void 0 ? void 0 : lastVideoStat.framesDecoded) !== null && _h !== void 0 ? _h : 0);
droppedFrames = ((_j = videoSample.framesDropped) !== null && _j !== void 0 ? _j : 0) - ((_k = lastVideoStat === null || lastVideoStat === void 0 ? void 0 : lastVideoStat.framesDropped) !== null && _k !== void 0 ? _k : 0);
receivedFrames = ((_l = videoSample.framesReceived) !== null && _l !== void 0 ? _l : 0) - ((_m = lastVideoStat === null || lastVideoStat === void 0 ? void 0 : lastVideoStat.framesReceived) !== null && _m !== void 0 ? _m : 0);
}
else if (this.kind === 'audio') {
const audioSample = sample;
const lastAudioStat = lastStat;
silentConcealedSamples = ((_o = audioSample.silentConcealedSamples) !== null && _o !== void 0 ? _o : 0) - ((_p = lastAudioStat === null || lastAudioStat === void 0 ? void 0 : lastAudioStat.silentConcealedSamples) !== null && _p !== void 0 ? _p : 0);
}
const stats = Object.assign(Object.assign({}, sample), { fractionLost,
rttInMs,
bitrate, ssrc: sample.ssrc });
bitrate, ssrc: sample.ssrc, lostPackets,
receivedPackets,
receivedFrames,
decodedFrames,
droppedFrames,
silentConcealedSamples });
this._stats.set(sample.ssrc, stats);
this.bitrate = [...this._stats.values()].reduce((acc, stat) => acc + stat.bitrate, 0);
this.rttInMs = [...this._stats.values()].reduce((acc, stat) => { var _a; return acc + ((_a = stat.rttInMs) !== null && _a !== void 0 ? _a : 0); }, 0) / (this._stats.size || 1);
this.lostPackets = [...this._stats.values()].reduce((acc, stat) => { var _a; return acc + ((_a = stat.lostPackets) !== null && _a !== void 0 ? _a : 0); }, 0);
this.receivedPackets = [...this._stats.values()].reduce((acc, stat) => { var _a; return acc + ((_a = stat.receivedPackets) !== null && _a !== void 0 ? _a : 0); }, 0);
this.receivedFrames = [...this._stats.values()].reduce((acc, stat) => { var _a; return acc + ((_a = stat.receivedFrames) !== null && _a !== void 0 ? _a : 0); }, 0);
this.decodedFrames = [...this._stats.values()].reduce((acc, stat) => { var _a; return acc + ((_a = stat.decodedFrames) !== null && _a !== void 0 ? _a : 0); }, 0);
this.droppedFrames = [...this._stats.values()].reduce((acc, stat) => { var _a; return acc + ((_a = stat.droppedFrames) !== null && _a !== void 0 ? _a : 0); }, 0);
this.receivedSamples = [...this._stats.values()].reduce((acc, stat) => { var _a; return acc + ((_a = stat.receivedSamples) !== null && _a !== void 0 ? _a : 0); }, 0);
this.silentConcealedSamples = [...this._stats.values()].reduce((acc, stat) => { var _a; return acc + ((_a = stat.silentConcealedSamples) !== null && _a !== void 0 ? _a : 0); }, 0);
this.fractionLoss = 0 < this.receivedPackets && 0 < this.lostPackets ? (this.lostPackets / (this.receivedPackets + this.lostPackets)) : 0;
if (executeSave)

@@ -182,0 +219,0 @@ yield this._save();

/// <reference types="node" />
import { EventEmitter } from 'events';
import { StorageProvider } from './storages/StorageProvider';
import { PeerConnectionTransport } from '@observertc/sample-schemas-js';
import { IceLocalCandidate, IceRemoteCandidate, PeerConnectionTransport } from '@observertc/sample-schemas-js';
import { ObservedClient } from './ObservedClient';
import { ObservedInboundTrack, ObservedInboundTrackConfig } from './ObservedInboundTrack';
import { ObservedOutboundTrack, ObservedOutboundTrackConfig } from './ObservedOutboundTrack';
import { ObservedICE } from './ObservedICE';
export type ObservedPeerConnectionEvents = {

@@ -15,2 +16,5 @@ update: [];

newoutboundvideotrack: [ObservedOutboundTrack<'video'>];
iceconnectionstatechange: [string];
icegatheringstatechange: [string];
connectionstatechange: [string];
};

@@ -32,5 +36,35 @@ export type ObservedPeerConnectionConfig = {

static create(config: ObservedPeerConnectionConfig, client: ObservedClient, storageProvider: StorageProvider): Promise<ObservedPeerConnection>;
totalInboundPacketsLost: number;
totalInboundPacketsReceived: number;
totalOutboundPacketsLost: number;
totalOutboundPacketsReceived: number;
totalOutboundPacketsSent: number;
totalDataChannelBytesSent: number;
totalDataChannelBytesReceived: number;
totalSentAudioBytes: number;
totalSentVideoBytes: number;
totalReceivedAudioBytes: number;
totalReceivedVideoBytes: number;
deltaInboundPacketsLost: number;
deltaInboundPacketsReceived: number;
deltaOutboundPacketsLost: number;
deltaOutboundPacketsReceived: number;
deltaOutboundPacketsSent: number;
deltaDataChannelBytesSent: number;
deltaDataChannelBytesReceived: number;
deltaReceivedAudioBytes: number;
deltaReceivedVideoBytes: number;
deltaSentAudioBytes: number;
deltaSentVideoBytes: number;
sendingAudioBitrate: number;
sendingVideoBitrate: number;
receivingAudioBitrate: number;
receivingVideoBitrate: number;
avgRttInS?: number;
private _closed;
private _updated;
private _sample?;
private _selectedLocalIceCandidate?;
private _selectedRemoteIceCandidate?;
readonly ICE: ObservedICE;
private readonly _inboundAudioTracks;

@@ -46,2 +80,4 @@ private readonly _inboundVideoTracks;

get updated(): number;
get selectedLocalIceCandidate(): IceLocalCandidate | undefined;
get selectedRemoteIceCandidate(): IceRemoteCandidate | undefined;
get inboundAudioTracks(): ReadonlyMap<string, ObservedInboundTrack<'audio'>>;

@@ -53,3 +89,5 @@ get inboundVideoTracks(): ReadonlyMap<string, ObservedInboundTrack<'video'>>;

close(): void;
updateMetrics(): void;
update(sample: PeerConnectionTransport, timestamp: number): void;
updateSelectedCandidate(localCandidate: IceLocalCandidate, remoteCandidate: IceRemoteCandidate): void;
createInboundAudioTrack(config: Omit<ObservedInboundTrackConfig<'audio'>, 'kind'>): Promise<ObservedInboundTrack<'audio'>>;

@@ -56,0 +94,0 @@ createInboundVideoTrack(config: Omit<ObservedInboundTrackConfig<'video'>, 'kind'>): Promise<ObservedInboundTrack<'video'>>;

@@ -41,2 +41,3 @@ "use strict";

const SingleExecutor_1 = require("./common/SingleExecutor");
const ObservedICE_1 = require("./ObservedICE");
class ObservedPeerConnection extends events_1.EventEmitter {

@@ -63,4 +64,31 @@ static create(config, client, storageProvider) {

this._storageProvider = _storageProvider;
this.totalInboundPacketsLost = 0;
this.totalInboundPacketsReceived = 0;
this.totalOutboundPacketsLost = 0;
this.totalOutboundPacketsReceived = 0;
this.totalOutboundPacketsSent = 0;
this.totalDataChannelBytesSent = 0;
this.totalDataChannelBytesReceived = 0;
this.totalSentAudioBytes = 0;
this.totalSentVideoBytes = 0;
this.totalReceivedAudioBytes = 0;
this.totalReceivedVideoBytes = 0;
this.deltaInboundPacketsLost = 0;
this.deltaInboundPacketsReceived = 0;
this.deltaOutboundPacketsLost = 0;
this.deltaOutboundPacketsReceived = 0;
this.deltaOutboundPacketsSent = 0;
this.deltaDataChannelBytesSent = 0;
this.deltaDataChannelBytesReceived = 0;
this.deltaReceivedAudioBytes = 0;
this.deltaReceivedVideoBytes = 0;
this.deltaSentAudioBytes = 0;
this.deltaSentVideoBytes = 0;
this.sendingAudioBitrate = 0;
this.sendingVideoBitrate = 0;
this.receivingAudioBitrate = 0;
this.receivingVideoBitrate = 0;
this._closed = false;
this._updated = Date.now();
this.ICE = ObservedICE_1.ObservedICE.create(this);
this._inboundAudioTracks = new Map();

@@ -85,2 +113,8 @@ this._inboundVideoTracks = new Map();

}
get selectedLocalIceCandidate() {
return this._selectedLocalIceCandidate;
}
get selectedRemoteIceCandidate() {
return this._selectedRemoteIceCandidate;
}
get inboundAudioTracks() {

@@ -113,2 +147,25 @@ return this._inboundAudioTracks;

}
updateMetrics() {
this.deltaInboundPacketsLost = 0;
this.deltaInboundPacketsReceived = 0;
this.deltaOutboundPacketsLost = 0;
this.deltaOutboundPacketsReceived = 0;
this.deltaOutboundPacketsSent = 0;
this.sendingAudioBitrate = 0;
this.sendingVideoBitrate = 0;
this.receivingAudioBitrate = 0;
this.receivingVideoBitrate = 0;
this.deltaDataChannelBytesSent = 0;
this.deltaDataChannelBytesReceived = 0;
this.deltaReceivedAudioBytes = 0;
this.deltaReceivedVideoBytes = 0;
this.deltaSentAudioBytes = 0;
this.deltaSentVideoBytes = 0;
this._inboundAudioTracks.forEach((track) => {
this.deltaReceivedAudioBytes += track.receivedPackets;
});
this._inboundVideoTracks.forEach((track) => {
this.deltaReceivedVideoBytes += track.receivedPackets;
});
}
update(sample, timestamp) {

@@ -125,2 +182,6 @@ if (this._closed)

}
updateSelectedCandidate(localCandidate, remoteCandidate) {
this._selectedLocalIceCandidate = localCandidate;
this._selectedRemoteIceCandidate = remoteCandidate;
}
createInboundAudioTrack(config) {

@@ -127,0 +188,0 @@ return __awaiter(this, void 0, void 0, function* () {

{
"name": "@observertc/observer-js",
"version": "0.30.1-beta",
"version": "0.30.2-beta",
"description": "Server Side NodeJS Library for processing ObserveRTC Samples",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

import { CallEventReport } from '@observertc/report-schemas-js';
import { CallEventType } from './CallEventType';
// eslint-disable-next-line no-shadow
export enum CallEventType {
CALL_STARTED = 'CALL_STARTED',
CALL_ENDED = 'CALL_ENDED',
CLIENT_JOINED = 'CLIENT_JOINED',
CLIENT_LEFT = 'CLIENT_LEFT',
PEER_CONNECTION_OPENED = 'PEER_CONNECTION_OPENED',
PEER_CONNECTION_CLOSED = 'PEER_CONNECTION_CLOSED',
MEDIA_TRACK_ADDED = 'MEDIA_TRACK_ADDED',
MEDIA_TRACK_REMOVED = 'MEDIA_TRACK_REMOVED',
}
export function createCallStartedEventReport(

@@ -15,0 +5,0 @@ serviceId: string,

@@ -1,2 +0,2 @@

// @generated by protoc-gen-es v1.1.1 with parameter "target=ts"
// @generated by protoc-gen-es v1.7.2 with parameter "target=ts"
// @generated from file models.proto (package org.observertc.observer.models, syntax proto2)

@@ -8,3 +8,3 @@ /* eslint-disable */

import { Message, proto2 } from "@bufbuild/protobuf";
import { Samples_ClientSample_Browser, Samples_ClientSample_Engine, Samples_ClientSample_IceCandidatePair, Samples_ClientSample_IceLocalCandidate, Samples_ClientSample_IceRemoteCandidate, Samples_ClientSample_InboundAudioTrack, Samples_ClientSample_InboundVideoTrack, Samples_ClientSample_OperationSystem, Samples_ClientSample_OutboundAudioTrack, Samples_ClientSample_OutboundVideoTrack, Samples_ClientSample_PeerConnectionTransport, Samples_ClientSample_Platform } from "./samples_pb";
import { Samples_ClientSample_Browser, Samples_ClientSample_Engine, Samples_ClientSample_OperationSystem, Samples_ClientSample_Platform } from "./samples_pb";

@@ -73,45 +73,2 @@ /**

/**
* @generated from message org.observertc.observer.models.ClientCoordinate
*/
export class ClientCoordinate extends Message<ClientCoordinate> {
/**
* @generated from field: required float latitude = 1;
*/
latitude?: number;
/**
* @generated from field: required float longitude = 2;
*/
longitude?: number;
constructor(data?: PartialMessage<ClientCoordinate>) {
super();
proto2.util.initPartial(data, this);
}
static readonly runtime: typeof proto2 = proto2;
static readonly typeName = "org.observertc.observer.models.ClientCoordinate";
static readonly fields: FieldList = proto2.util.newFieldList(() => [
{ no: 1, name: "latitude", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
{ no: 2, name: "longitude", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ClientCoordinate {
return new ClientCoordinate().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ClientCoordinate {
return new ClientCoordinate().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ClientCoordinate {
return new ClientCoordinate().fromJsonString(jsonString, options);
}
static equals(a: ClientCoordinate | PlainMessage<ClientCoordinate> | undefined, b: ClientCoordinate | PlainMessage<ClientCoordinate> | undefined): boolean {
return proto2.util.equals(ClientCoordinate, a, b);
}
}
/**
* @generated from message org.observertc.observer.models.Client

@@ -195,15 +152,2 @@ */

/**
* message Stats {
* optional double maxRttInS = 1;
* optional double minRttInS = 2;
* optional string location = 3;
* }
*
* optional Stats stats = 13;
*
* @generated from field: optional org.observertc.observer.models.ClientCoordinate coordinates = 16;
*/
coordinates?: ClientCoordinate;
constructor(data?: PartialMessage<Client>) {

@@ -232,3 +176,2 @@ super();

{ no: 15, name: "engine", kind: "message", T: Samples_ClientSample_Engine, opt: true },
{ no: 16, name: "coordinates", kind: "message", T: ClientCoordinate, opt: true },
]);

@@ -318,22 +261,2 @@

/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceLocalCandidate icelocalCandidates = 13;
*/
icelocalCandidates: Samples_ClientSample_IceLocalCandidate[] = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceRemoteCandidate iceRemoteCandidates = 14;
*/
iceRemoteCandidates: Samples_ClientSample_IceRemoteCandidate[] = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.IceCandidatePair iceCandidatePairs = 15;
*/
iceCandidatePairs: Samples_ClientSample_IceCandidatePair[] = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.PeerConnectionTransport transports = 16;
*/
transports: Samples_ClientSample_PeerConnectionTransport[] = [];
/**
* @generated from field: optional uint64 touched = 17;

@@ -363,6 +286,2 @@ */

{ no: 12, name: "outboundTrackIds", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
{ no: 13, name: "icelocalCandidates", kind: "message", T: Samples_ClientSample_IceLocalCandidate, repeated: true },
{ no: 14, name: "iceRemoteCandidates", kind: "message", T: Samples_ClientSample_IceRemoteCandidate, repeated: true },
{ no: 15, name: "iceCandidatePairs", kind: "message", T: Samples_ClientSample_IceCandidatePair, repeated: true },
{ no: 16, name: "transports", kind: "message", T: Samples_ClientSample_PeerConnectionTransport, repeated: true },
{ no: 17, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },

@@ -398,2 +317,4 @@ ]);

/**
* optional org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack sample = 4;
*
* @generated from field: optional float fps = 2;

@@ -403,7 +324,2 @@ */

/**
* @generated from field: optional org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack sample = 4;
*/
sample?: Samples_ClientSample_InboundVideoTrack;
constructor(data?: PartialMessage<InboundTrackVideoStats>) {

@@ -419,3 +335,2 @@ super();

{ no: 2, name: "fps", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true },
{ no: 4, name: "sample", kind: "message", T: Samples_ClientSample_InboundVideoTrack, opt: true },
]);

@@ -564,12 +479,2 @@

/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundAudioTrack audioStats = 15;
*/
audioStats: Samples_ClientSample_InboundAudioTrack[] = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack videoStats = 16;
*/
videoStats: Samples_ClientSample_InboundVideoTrack[] = [];
/**
* @generated from field: optional uint64 touched = 17;

@@ -601,4 +506,2 @@ */

{ no: 14, name: "ssrc", kind: "scalar", T: 3 /* ScalarType.INT64 */, repeated: true },
{ no: 15, name: "audioStats", kind: "message", T: Samples_ClientSample_InboundAudioTrack, repeated: true },
{ no: 16, name: "videoStats", kind: "message", T: Samples_ClientSample_InboundVideoTrack, repeated: true },
{ no: 17, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },

@@ -694,12 +597,2 @@ ]);

/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.OutboundAudioTrack audioStats = 14;
*/
audioStats: Samples_ClientSample_OutboundAudioTrack[] = [];
/**
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.OutboundVideoTrack videoStats = 15;
*/
videoStats: Samples_ClientSample_OutboundVideoTrack[] = [];
/**
* @generated from field: optional uint64 touched = 16;

@@ -730,4 +623,2 @@ */

{ no: 13, name: "ssrc", kind: "scalar", T: 3 /* ScalarType.INT64 */, repeated: true },
{ no: 14, name: "audioStats", kind: "message", T: Samples_ClientSample_OutboundAudioTrack, repeated: true },
{ no: 15, name: "videoStats", kind: "message", T: Samples_ClientSample_OutboundVideoTrack, repeated: true },
{ no: 16, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },

@@ -734,0 +625,0 @@ ]);

@@ -1,2 +0,2 @@

import { ClientSample, IceLocalCandidate } from '@observertc/sample-schemas-js';
import { ClientSample } from '@observertc/sample-schemas-js';
import { ObservedCall } from './ObservedCall';

@@ -12,5 +12,5 @@ import * as Models from './models/Models';

import { Samples_ClientSample_Browser, Samples_ClientSample_Engine, Samples_ClientSample_OperationSystem, Samples_ClientSample_Platform } from './models/samples_pb';
import { IceCandidatePairReport } from '@observertc/report-schemas-js';
import { isValidUuid } from './common/utils';
import { createClientJoinedEventReport, createClientLeftEventReport } from './common/callEventReports';
import { CallEventType } from './common/CallEventType';

@@ -37,3 +37,2 @@ const logger = createLogger('ObservedClient');

'processing-sample-overflow': [],
'candidate-pair-change': [],
newpeerconnection: [ObservedPeerConnection],

@@ -102,7 +101,35 @@ };

private _processingSample = 0;
private _selectedLocalIceCandidate?: IceLocalCandidate;
private _selectedRemoteIceCandidate?: IceLocalCandidate;
private _timeZoneOffsetInHours?: number;
private _leaveReported = false;
public totalInboundPacketsLost = 0;
public totalInboundPacketsReceived = 0;
public totalOutboundPacketsLost = 0;
public totalOutboundPacketsReceived = 0;
public totalOutboundPacketsSent = 0;
public totalDataChannelBytesSent = 0;
public totalDataChannelBytesReceived = 0;
public totalSentAudioBytes = 0;
public totalSentVideoBytes = 0;
public totalReceivedAudioBytes = 0;
public totalReceivedVideoBytes = 0;
public deltaInboundPacketsLost?: number;
public deltaInboundPacketsReceived?: number;
public deltaOutboundPacketsLost?: number;
public deltaOutboundPacketsReceived?: number;
public deltaOutboundPacketsSent?: number;
public deltaDataChannelBytesSent?: number;
public deltaDataChannelBytesReceived?: number;
public deltaReceivedAudioBytes?: number;
public deltaReceivedVideoBytes?: number;
public deltaSentAudioBytes?: number;
public deltaSentVideoBytes?: number;
public avgRttInS?: number;
public sendingAudioBitrate?: number;
public sendingVideoBitrate?: number;
public receivingAudioBitrate?: number;
public receivingVideoBitrate?: number;
public readonly mediaDevices: string[] = [];

@@ -159,10 +186,2 @@ public readonly codecs: string[] = [];

public get selectedLocalIceCandidate() {
return this._selectedLocalIceCandidate;
}
public get selectedRemoteIceCandidate() {
return this._selectedRemoteIceCandidate;
}
public get timeZoneOffsetInHours() {

@@ -387,4 +406,19 @@ return this._timeZoneOffsetInHours;

for (const { timestamp = Date.now(), ...callEvent } of sample.customCallEvents ?? []) {
if (callEvent.name === 'CLIENT_LEFT') this._leaveReported = true;
const peerConnection = this._peerConnections.get(callEvent.peerConnectionId ?? '');
switch (callEvent.name) {
case CallEventType.CLIENT_LEFT:
this._leaveReported = true;
break;
case CallEventType.ICE_CONNECTION_STATE_CHANGED:
peerConnection && callEvent.value && peerConnection.emit('iceconnectionstatechange', callEvent.value);
break;
case CallEventType.ICE_GATHERING_STATE_CHANGED:
peerConnection && callEvent.value && peerConnection.emit('icegatheringstatechange', callEvent.value);
break;
case CallEventType.PEER_CONNECTION_STATE_CHANGED:
peerConnection && callEvent.value && peerConnection.emit('connectionstatechange', callEvent.value);
break;
}
this.reports.addCallEventReport({

@@ -488,73 +522,3 @@ serviceId: this.serviceId,

}
let selectedLocalCandidateId: string | undefined;
let selectedRemoteCandidateId: string | undefined;
for (const candidatePair of sample.iceCandidatePairs ?? []) {
if (candidatePair.nominated) {
if (!selectedLocalCandidateId) selectedLocalCandidateId = candidatePair.localCandidateId;
if (!selectedRemoteCandidateId) selectedRemoteCandidateId = candidatePair.remoteCandidateId;
}
const report: IceCandidatePairReport = {
serviceId: this.serviceId,
mediaUnitId: this.mediaUnitId,
roomId: this.roomId,
callId: this.callId,
clientId: this.clientId,
userId: this.userId,
timestamp: sample.timestamp,
...candidatePair,
sampleSeq: -1, // deprecated
};
this.reports.addIceCandidatePairReport(report);
}
let changeIceCandidatePair = false;
for (const iceLocalCandidate of sample.iceLocalCandidates ?? []) {
if (
iceLocalCandidate.id && selectedLocalCandidateId &&
iceLocalCandidate.id === selectedLocalCandidateId &&
this._selectedLocalIceCandidate?.id !== iceLocalCandidate.id
) {
this._selectedLocalIceCandidate = iceLocalCandidate;
changeIceCandidatePair = true;
}
const callMetaReport = createCallMetaReport(
this.serviceId,
this.mediaUnitId,
this.roomId,
this.callId,
this.clientId, {
type: CallMetaType.ICE_LOCAL_CANDIDATE,
payload: iceLocalCandidate,
}, this.userId);
this.reports.addCallMetaReport(callMetaReport);
}
for (const iceRemoteCandidate of sample.iceRemoteCandidates ?? []) {
if (
iceRemoteCandidate.id && selectedRemoteCandidateId &&
iceRemoteCandidate.id === selectedRemoteCandidateId &&
this._selectedRemoteIceCandidate?.id !== iceRemoteCandidate.id
) {
this._selectedRemoteIceCandidate = iceRemoteCandidate;
changeIceCandidatePair = true;
}
const callMetaReport = createCallMetaReport(
this.serviceId,
this.mediaUnitId,
this.roomId,
this.callId,
this.clientId, {
type: CallMetaType.ICE_REMOTE_CANDIDATE,
payload: iceRemoteCandidate,
}, this.userId);
this.reports.addCallMetaReport(callMetaReport);
}
for (const transport of sample.pcTransports ?? []) {

@@ -685,2 +649,44 @@ try {

for (const iceLocalCandidate of sample.iceLocalCandidates ?? []) {
if (!iceLocalCandidate.peerConnectionId) {
logger.warn(`Local ice candidate without peerConnectionId: ${JSON.stringify(iceLocalCandidate)}`);
continue;
}
const peerConnection = this._peerConnections.get(iceLocalCandidate.peerConnectionId);
if (!peerConnection) {
logger.debug(`Peer connection ${iceLocalCandidate.peerConnectionId} not found for ice local candidate ${iceLocalCandidate.id}`);
continue;
}
peerConnection.ICE.addLocalCandidate(iceLocalCandidate);
}
for (const iceRemoteCandidate of sample.iceRemoteCandidates ?? []) {
if (!iceRemoteCandidate.peerConnectionId) {
logger.warn(`Remote ice candidate without peerConnectionId: ${JSON.stringify(iceRemoteCandidate)}`);
continue;
}
const peerConnection = this._peerConnections.get(iceRemoteCandidate.peerConnectionId);
if (!peerConnection) {
logger.debug(`Peer connection ${iceRemoteCandidate.peerConnectionId} not found for ice remote candidate ${iceRemoteCandidate.id}`);
continue;
}
peerConnection.ICE.addRemoteCandidate(iceRemoteCandidate);
}
for (const candidatePair of sample.iceCandidatePairs ?? []) {
const peerConnection = this._peerConnections.get(candidatePair.peerConnectionId);
if (!peerConnection) {
logger.debug(`Peer connection ${candidatePair.peerConnectionId} not found for ice candidate pair ${candidatePair.localCandidateId}, ${candidatePair.remoteCandidateId}`);
continue;
}
peerConnection.ICE.update(candidatePair, sample.timestamp);
}
// close entries that are idle for too long

@@ -717,6 +723,2 @@ if (this.call.observer.config.maxEntryIdleTimeInMs && this._updated < sample.timestamp) {

if (changeIceCandidatePair) {
this.emit('candidate-pair-change');
}
if (executeSave) await this._save();

@@ -723,0 +725,0 @@

@@ -31,2 +31,10 @@ import { EventEmitter } from 'events';

rttInMs?: number;
lostPackets?: number;
receivedPackets?: number;
receivedFrames?: number;
decodedFrames?: number;
droppedFrames?: number;
receivedSamples?: number;
silentConcealedSamples?: number;
fractionLoss?: number;
};

@@ -80,2 +88,10 @@

public rttInMs = -1;
public lostPackets = 0;
public receivedPackets = 0;
public receivedFrames = 0;
public decodedFrames = 0;
public droppedFrames = 0;
public receivedSamples = 0;
public silentConcealedSamples = 0;
public fractionLoss = 0;

@@ -216,2 +232,21 @@ private constructor(

const fractionLost = 0 < receivedPackets && 0 < lostPackets ? (lostPackets / (receivedPackets + lostPackets)) : 0;
let decodedFrames: number | undefined;
let droppedFrames: number | undefined;
let receivedFrames: number | undefined;
let silentConcealedSamples: number | undefined;
if (this.kind === 'video') {
const videoSample = sample as InboundVideoTrack;
const lastVideoStat = lastStat as InboundVideoTrack | undefined;
decodedFrames = (videoSample.framesDecoded ?? 0) - (lastVideoStat?.framesDecoded ?? 0);
droppedFrames = (videoSample.framesDropped ?? 0) - (lastVideoStat?.framesDropped ?? 0);
receivedFrames = (videoSample.framesReceived ?? 0) - (lastVideoStat?.framesReceived ?? 0);
} else if (this.kind === 'audio') {
const audioSample = sample as InboundAudioTrack;
const lastAudioStat = lastStat as InboundAudioTrack | undefined;
silentConcealedSamples = (audioSample.silentConcealedSamples ?? 0) - (lastAudioStat?.silentConcealedSamples ?? 0);
}
const stats: ObservedInboundTrackStats<Kind> = {

@@ -223,2 +258,8 @@ ...sample,

ssrc: sample.ssrc,
lostPackets,
receivedPackets,
receivedFrames,
decodedFrames,
droppedFrames,
silentConcealedSamples,
};

@@ -230,3 +271,11 @@

this.rttInMs = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.rttInMs ?? 0), 0) / (this._stats.size || 1);
this.lostPackets = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.lostPackets ?? 0), 0);
this.receivedPackets = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.receivedPackets ?? 0), 0);
this.receivedFrames = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.receivedFrames ?? 0), 0);
this.decodedFrames = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.decodedFrames ?? 0), 0);
this.droppedFrames = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.droppedFrames ?? 0), 0);
this.receivedSamples = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.receivedSamples ?? 0), 0);
this.silentConcealedSamples = [ ...this._stats.values() ].reduce((acc, stat) => acc + (stat.silentConcealedSamples ?? 0), 0);
this.fractionLoss = 0 < this.receivedPackets && 0 < this.lostPackets ? (this.lostPackets / (this.receivedPackets + this.lostPackets)) : 0;
if (executeSave) await this._save();

@@ -233,0 +282,0 @@

import { EventEmitter } from 'events';
import * as Models from './models/Models';
import { StorageProvider } from './storages/StorageProvider';
import { PeerConnectionTransport } from '@observertc/sample-schemas-js';
import { IceLocalCandidate, IceRemoteCandidate, PeerConnectionTransport } from '@observertc/sample-schemas-js';
import { ObservedClient } from './ObservedClient';

@@ -10,2 +10,3 @@ import { ObservedInboundTrack, ObservedInboundTrackConfig } from './ObservedInboundTrack';

import { createSingleExecutor } from './common/SingleExecutor';
import { ObservedICE } from './ObservedICE';

@@ -19,2 +20,6 @@ export type ObservedPeerConnectionEvents = {

newoutboundvideotrack: [ObservedOutboundTrack<'video'>],
iceconnectionstatechange: [string],
icegatheringstatechange: [string],
connectionstatechange: [string],
};

@@ -56,6 +61,39 @@

public totalInboundPacketsLost = 0;
public totalInboundPacketsReceived = 0;
public totalOutboundPacketsLost = 0;
public totalOutboundPacketsReceived = 0;
public totalOutboundPacketsSent = 0;
public totalDataChannelBytesSent = 0;
public totalDataChannelBytesReceived = 0;
public totalSentAudioBytes = 0;
public totalSentVideoBytes = 0;
public totalReceivedAudioBytes = 0;
public totalReceivedVideoBytes = 0;
public deltaInboundPacketsLost = 0;
public deltaInboundPacketsReceived = 0;
public deltaOutboundPacketsLost = 0;
public deltaOutboundPacketsReceived = 0;
public deltaOutboundPacketsSent = 0;
public deltaDataChannelBytesSent = 0;
public deltaDataChannelBytesReceived = 0;
public deltaReceivedAudioBytes = 0;
public deltaReceivedVideoBytes = 0;
public deltaSentAudioBytes = 0;
public deltaSentVideoBytes = 0;
public sendingAudioBitrate = 0;
public sendingVideoBitrate = 0;
public receivingAudioBitrate = 0;
public receivingVideoBitrate = 0;
public avgRttInS?: number;
private _closed = false;
private _updated = Date.now();
private _sample?: ObservedPeerConnectionStats;
private _selectedLocalIceCandidate?: IceLocalCandidate;
private _selectedRemoteIceCandidate?: IceRemoteCandidate;
public readonly ICE = ObservedICE.create(this);
private readonly _inboundAudioTracks = new Map<string, ObservedInboundTrack<'audio'>>();

@@ -92,2 +130,10 @@ private readonly _inboundVideoTracks = new Map<string, ObservedInboundTrack<'video'>>();

public get selectedLocalIceCandidate() {
return this._selectedLocalIceCandidate;
}
public get selectedRemoteIceCandidate() {
return this._selectedRemoteIceCandidate;
}
public get inboundAudioTracks(): ReadonlyMap<string, ObservedInboundTrack<'audio'>> {

@@ -127,2 +173,28 @@ return this._inboundAudioTracks;

public updateMetrics() {
this.deltaInboundPacketsLost = 0;
this.deltaInboundPacketsReceived = 0;
this.deltaOutboundPacketsLost = 0;
this.deltaOutboundPacketsReceived = 0;
this.deltaOutboundPacketsSent = 0;
this.sendingAudioBitrate = 0;
this.sendingVideoBitrate = 0;
this.receivingAudioBitrate = 0;
this.receivingVideoBitrate = 0;
this.deltaDataChannelBytesSent = 0;
this.deltaDataChannelBytesReceived = 0;
this.deltaReceivedAudioBytes = 0;
this.deltaReceivedVideoBytes = 0;
this.deltaSentAudioBytes = 0;
this.deltaSentVideoBytes = 0;
this._inboundAudioTracks.forEach((track) => {
this.deltaReceivedAudioBytes += track.receivedPackets;
});
this._inboundVideoTracks.forEach((track) => {
this.deltaReceivedVideoBytes += track.receivedPackets;
});
}
public update(sample: PeerConnectionTransport, timestamp: number) {

@@ -152,2 +224,7 @@ if (this._closed) return;

public updateSelectedCandidate(localCandidate: IceLocalCandidate, remoteCandidate: IceRemoteCandidate) {
this._selectedLocalIceCandidate = localCandidate;
this._selectedRemoteIceCandidate = remoteCandidate;
}
public async createInboundAudioTrack(config: Omit<ObservedInboundTrackConfig<'audio'>, 'kind'>): Promise<ObservedInboundTrack<'audio'>> {

@@ -160,3 +237,3 @@ if (this._closed) throw new Error(`PeerConnection ${this.peerConnectionId} is closed`);

}, this, this._storageProvider);
result.on('close', () => {

@@ -163,0 +240,0 @@ this._inboundAudioTracks.delete(result.trackId);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc