@observertc/observer-js
Advanced tools
Comparing version 0.9.11-beta to 0.9.12-beta
@@ -62,3 +62,3 @@ import { CallMetaReport } from '@observertc/report-schemas-js'; | ||
}; | ||
export declare function createCallMetaReport(serviceId: string, mediaUnitId: string, roomId: string, callId: string, clientId: string, reportType: CallMetaReportType, timestamp?: number): CallMetaReport; | ||
export declare function createCallMetaReport(serviceId: string, mediaUnitId: string, roomId: string, callId: string, clientId: string, reportType: CallMetaReportType, userId?: string, timestamp?: number): CallMetaReport; | ||
//# sourceMappingURL=callMetaReports.d.ts.map |
@@ -21,3 +21,3 @@ "use strict"; | ||
})(CallMetaType = exports.CallMetaType || (exports.CallMetaType = {})); | ||
function createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, reportType, timestamp) { | ||
function createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, reportType, userId, timestamp) { | ||
const report = { | ||
@@ -30,2 +30,3 @@ type: reportType.type, | ||
clientId, | ||
userId, | ||
payload: JSON.stringify(reportType.payload), | ||
@@ -32,0 +33,0 @@ timestamp: timestamp !== null && timestamp !== void 0 ? timestamp : Date.now(), |
@@ -5,2 +5,3 @@ export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; | ||
} : T; | ||
export declare function iteratorConverter<T>(generator: Generator<T, void, undefined>): IterableIterator<T>; | ||
//# sourceMappingURL=utils.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.iteratorConverter = void 0; | ||
function iteratorConverter(generator) { | ||
return { | ||
[Symbol.iterator]() { | ||
return this; | ||
}, | ||
next() { | ||
return generator.next(); | ||
}, | ||
}; | ||
} | ||
exports.iteratorConverter = iteratorConverter; |
@@ -12,2 +12,4 @@ import { Semaphore } from './common/Semaphore'; | ||
fetchSamples: boolean; | ||
maxIdleTimeInMs?: number; | ||
findRemoteMatches?: boolean; | ||
}; | ||
@@ -14,0 +16,0 @@ export type EvaluatorProcess = (evaluatorContext: EvaluatorContext) => Promise<void>; |
@@ -14,2 +14,3 @@ "use strict"; | ||
constructor(config, _callSemaphore, _storageProvider, _reportsCollector) { | ||
var _a; | ||
this.config = config; | ||
@@ -25,3 +26,3 @@ this._callSemaphore = _callSemaphore; | ||
this._callProcessor = (0, CallProcessor_1.createCallProcessor)(_storageProvider, _reportsCollector); | ||
this._transactionProcessor = (0, TransactoinProcessor_1.createTransactionProcessor)(_storageProvider, _reportsCollector, this.config.fetchSamples); | ||
this._transactionProcessor = (0, TransactoinProcessor_1.createTransactionProcessor)(_storageProvider, _reportsCollector, this.config.fetchSamples, BigInt((_a = this.config.maxIdleTimeInMs) !== null && _a !== void 0 ? _a : 10000), this.config.findRemoteMatches); | ||
this._customProcessor = (0, Processor_1.createProcessor)(); | ||
@@ -28,0 +29,0 @@ } |
@@ -7,29 +7,45 @@ "use strict"; | ||
const { clientStorage, peerConnectionStorage, inboundTrackStorage, outboundTrackStorage, sfuStorage, sfuTransportStorage, sfuInboundRtpPadStorage, sfuOutboundRtpPadStorage, sfuSctpChannelStorage, } = storageProvider; | ||
const [clients, sfus] = await Promise.all([clientStorage.getAll(observedCalls.clientIds()), sfuStorage.getAll([])]); | ||
const peerConnectionIds = Array.from(clients.values()).flatMap((client) => client.peerConnectionIds); | ||
const sfuTransportIds = Array.from(sfus.values()).flatMap((sfu) => sfu.sfuTransportIds); | ||
const [peerConnections, sfuTransports] = await Promise.all([ | ||
peerConnectionStorage.getAll(peerConnectionIds), | ||
sfuTransportStorage.getAll(sfuTransportIds), | ||
const [[clients, peerConnections, inboundAudioTrackEntries, inboundVideoTrackEntries, outboundAudioTrackEntries, outboundVideoTrackEntries,], [sfus, sfuTransports, sfuInboundRtpPads, sfuOutboundRtpPads, sfuSctpChannels]] = await Promise.all([ | ||
Promise.all([ | ||
clientStorage.getAll(observedCalls.clientIds()), | ||
peerConnectionStorage.getAll(observedCalls.peerConnectionIds()), | ||
inboundTrackStorage.getAll(observedCalls.inboundAudioTrackIds()), | ||
inboundTrackStorage.getAll(observedCalls.inboundVideoTrackIds()), | ||
outboundTrackStorage.getAll(observedCalls.outboundAudioTrackIds()), | ||
outboundTrackStorage.getAll(observedCalls.outboundVideoTrackIds()), | ||
]), | ||
Promise.all([ | ||
sfuStorage.getAll(observedSfus.sfuIds()), | ||
sfuTransportStorage.getAll(observedSfus.sfuTransportIds()), | ||
sfuInboundRtpPadStorage.getAll(observedCalls.peerConnectionIds()), | ||
sfuOutboundRtpPadStorage.getAll(observedCalls.peerConnectionIds()), | ||
sfuSctpChannelStorage.getAll(observedCalls.peerConnectionIds()), | ||
]) | ||
]); | ||
const peerConnectionValues = Array.from(peerConnections.values()); | ||
const inboundTrackIds = peerConnectionValues.flatMap((pc) => pc.inboundTrackIds); | ||
const outboundTrackIds = peerConnectionValues.flatMap((pc) => pc.outboundTrackIds); | ||
const sfuTransportValues = Array.from(sfuTransports.values()); | ||
const sfuInboundRtpPadIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.inboundRtpPadIds); | ||
const sfuOutboundRtpPadIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.outboundRtpPadIds); | ||
const sfuSctpChannelIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.sctpChannelIds); | ||
const [inboundTracks, outboundTracks, sfuInboundRtpPads, sfuOutboundRtpPads, sfuSctpChannels] = await Promise.all([ | ||
inboundTrackStorage.getAll(inboundTrackIds), | ||
outboundTrackStorage.getAll(outboundTrackIds), | ||
sfuInboundRtpPadStorage.getAll(sfuInboundRtpPadIds), | ||
sfuOutboundRtpPadStorage.getAll(sfuOutboundRtpPadIds), | ||
sfuSctpChannelStorage.getAll(sfuSctpChannelIds), | ||
]); | ||
const inboundTrackEntries = Array.from(inboundTracks); | ||
const outboundTrackEntries = Array.from(outboundTracks); | ||
const inboundAudioTrackEntries = inboundTrackEntries.filter((e) => e[1].kind === 'audio'); | ||
const inboundVideoTrackEntries = inboundTrackEntries.filter((e) => e[1].kind === 'video'); | ||
const outboundAudioTrackEntries = outboundTrackEntries.filter((e) => e[1].kind === 'audio'); | ||
const outboundVideoTrackEntries = outboundTrackEntries.filter((e) => e[1].kind === 'video'); | ||
// const peerConnectionIds = Array.from(clients.values()).flatMap((client) => client.peerConnectionIds); | ||
// const sfuTransportIds = Array.from(sfus.values()).flatMap((sfu) => sfu.sfuTransportIds); | ||
// const [peerConnections, sfuTransports] = await Promise.all([ | ||
// peerConnectionStorage.getAll(peerConnectionIds), | ||
// sfuTransportStorage.getAll(sfuTransportIds), | ||
// ]); | ||
// const peerConnectionValues = Array.from(peerConnections.values()); | ||
// const inboundTrackIds = peerConnectionValues.flatMap((pc) => pc.inboundTrackIds); | ||
// const outboundTrackIds = peerConnectionValues.flatMap((pc) => pc.outboundTrackIds); | ||
// const sfuTransportValues = Array.from(sfuTransports.values()); | ||
// const sfuInboundRtpPadIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.inboundRtpPadIds); | ||
// const sfuOutboundRtpPadIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.outboundRtpPadIds); | ||
// const sfuSctpChannelIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.sctpChannelIds); | ||
// const [inboundTracks, outboundTracks, sfuInboundRtpPads, sfuOutboundRtpPads, sfuSctpChannels] = await Promise.all([ | ||
// inboundTrackStorage.getAll(inboundTrackIds), | ||
// outboundTrackStorage.getAll(outboundTrackIds), | ||
// sfuInboundRtpPadStorage.getAll(sfuInboundRtpPadIds), | ||
// sfuOutboundRtpPadStorage.getAll(sfuOutboundRtpPadIds), | ||
// sfuSctpChannelStorage.getAll(sfuSctpChannelIds), | ||
// ]); | ||
// const inboundTrackEntries = Array.from(inboundTracks); | ||
// const outboundTrackEntries = Array.from(outboundTracks); | ||
// const inboundAudioTrackEntries = inboundTrackEntries.filter((e) => e[1].kind === 'audio'); | ||
// const inboundVideoTrackEntries = inboundTrackEntries.filter((e) => e[1].kind === 'video'); | ||
// const outboundAudioTrackEntries = outboundTrackEntries.filter((e) => e[1].kind === 'audio'); | ||
// const outboundVideoTrackEntries = outboundTrackEntries.filter((e) => e[1].kind === 'video'); | ||
const transactionContext = { | ||
@@ -36,0 +52,0 @@ id: (0, uuid_1.v4)(), |
@@ -5,3 +5,3 @@ import { ReportsCollector } from '../common/ReportsCollector'; | ||
import { TransactionContext } from './TransactionContext'; | ||
export declare function createTransactionProcessor(storageProvider: StorageProvider, reportsCollector: ReportsCollector, fetchSamples: boolean): Processor<TransactionContext>; | ||
export declare function createTransactionProcessor(storageProvider: StorageProvider, reportsCollector: ReportsCollector, fetchSamples: boolean, maxIdleTimeInMs: BigInt, findRemoteMatches?: boolean): Processor<TransactionContext>; | ||
//# sourceMappingURL=TransactoinProcessor.d.ts.map |
@@ -5,9 +5,11 @@ "use strict"; | ||
const CommitTransactionMiddleware_1 = require("./CommitTransactionMiddleware"); | ||
const DeleteOutdatedCallEntries_1 = require("./DeleteOutdatedCallEntries"); | ||
const DeleteOutdatedSfuEntries_1 = require("./DeleteOutdatedSfuEntries"); | ||
const Processor_1 = require("./Processor"); | ||
const VisitObservedCallsMiddleware_1 = require("./VisitObservedCallsMiddleware"); | ||
const VisitObservedSfusMiddleware_1 = require("./VisitObservedSfusMiddleware"); | ||
function createTransactionProcessor(storageProvider, reportsCollector, fetchSamples) { | ||
function createTransactionProcessor(storageProvider, reportsCollector, fetchSamples, maxIdleTimeInMs, findRemoteMatches) { | ||
return (0, Processor_1.createProcessor)( | ||
// all of these middlewares must execute sequentially! | ||
(0, VisitObservedCallsMiddleware_1.createVisitObservedCallsMiddleware)(reportsCollector, fetchSamples), (0, VisitObservedSfusMiddleware_1.createVisitObservedSfusMiddleware)(reportsCollector, fetchSamples), | ||
(0, VisitObservedCallsMiddleware_1.createVisitObservedCallsMiddleware)(storageProvider, reportsCollector, fetchSamples, findRemoteMatches), (0, VisitObservedSfusMiddleware_1.createVisitObservedSfusMiddleware)(reportsCollector, fetchSamples), (0, DeleteOutdatedCallEntries_1.createDeleteOutdatedCallEntries)(storageProvider, maxIdleTimeInMs), (0, DeleteOutdatedSfuEntries_1.createDeleteOutdatedSfuEntries)(storageProvider, maxIdleTimeInMs), | ||
// must be the last one! | ||
@@ -14,0 +16,0 @@ (0, CommitTransactionMiddleware_1.createCommitTransactionMiddleware)(storageProvider, reportsCollector)); |
import { Middleware } from './Middleware'; | ||
import { TransactionContext } from './TransactionContext'; | ||
import { ReportsCollector } from '../common/ReportsCollector'; | ||
import { StorageProvider } from '../storages/StorageProvider'; | ||
export declare const logger: import("../common/logger").WrappedLogger; | ||
export declare function createVisitObservedCallsMiddleware(reports: ReportsCollector, fetchSamples: boolean): Middleware<TransactionContext>; | ||
export declare function createVisitObservedCallsMiddleware(storages: StorageProvider, reports: ReportsCollector, fetchSamples: boolean, findRemoteMatches?: boolean): Middleware<TransactionContext>; | ||
//# sourceMappingURL=VisitObservedCallsMiddleware.d.ts.map |
@@ -11,6 +11,9 @@ "use strict"; | ||
const visitInboundVideoTrack_1 = require("./visitors/visitInboundVideoTrack"); | ||
const findRemoteMatches_1 = require("../processes/findRemoteMatches"); | ||
exports.logger = (0, logger_1.createLogger)('VisitObservedCallsMiddleware'); | ||
function createVisitObservedCallsMiddleware(reports, fetchSamples) { | ||
const emptyMap = new Map(); | ||
function createVisitObservedCallsMiddleware(storages, reports, fetchSamples, findRemoteMatches) { | ||
const process = async (transaction) => { | ||
const { observedCalls, clients, updatedPeerConnections, deletedPeerConnections, updatedInboundAudioTracks, deletedInboundAudioTracks, updatedInboundVideoTracks, deletedInboundVideoTracks, updatedOutboundAudioTracks, deletedOutboundAudioTracks, updatedOutboundVideoTracks, deletedOutboundVideoTracks, } = transaction; | ||
var _a, _b, _c, _d; | ||
const { observedCalls, clients, updatedPeerConnections, updatedInboundAudioTracks, updatedInboundVideoTracks, updatedOutboundAudioTracks, updatedOutboundVideoTracks, } = transaction; | ||
const visitedPeerConnectionIds = new Set(); | ||
@@ -21,2 +24,9 @@ const visitedInboundAudioTrackIds = new Set(); | ||
const visitedOutboundVideoTrackIds = new Set(); | ||
const { remoteTrackIds, remotePeerConnectionIds, remoteClientIds } = !findRemoteMatches ? { | ||
remoteTrackIds: emptyMap, | ||
remotePeerConnectionIds: emptyMap, | ||
remoteClientIds: emptyMap, | ||
} : await (0, findRemoteMatches_1.findRemoteMatches)(storages, clients, new Map([...updatedInboundAudioTracks, ...updatedInboundVideoTracks])); | ||
const now = BigInt(Date.now()); | ||
const fakeTouched = { touched: BigInt(0) }; | ||
for (const observedCall of observedCalls.observedCalls()) { | ||
@@ -27,3 +37,2 @@ const { callId, serviceId, roomId } = observedCall; | ||
const storedClient = clients.get(clientId); | ||
// console.warn("dskfjhdkfhsdkf", observedClient, storedClient); | ||
if (!storedClient) { | ||
@@ -44,12 +53,15 @@ // should not happen as client joined must have run before this | ||
} | ||
storedPeerConnection.touched = now; | ||
visitedPeerConnectionIds.add(peerConnectionId); | ||
for (const observedInboundAudioTrack of observedPeerConnection.inboundAudioTracks()) { | ||
const { trackId } = observedInboundAudioTrack; | ||
(0, visitInboundAudioTrack_1.visitInboundAudioTrack)(observedInboundAudioTrack, storedPeerConnection, updatedInboundAudioTracks, reports, fetchSamples); | ||
(0, visitInboundAudioTrack_1.visitInboundAudioTrack)(observedInboundAudioTrack, storedPeerConnection, updatedInboundAudioTracks, reports, fetchSamples, remoteTrackIds.get(trackId), remotePeerConnectionIds.get(trackId), remoteClientIds.get(trackId)); | ||
visitedInboundAudioTrackIds.add(trackId); | ||
((_a = updatedInboundAudioTracks.get(trackId)) !== null && _a !== void 0 ? _a : fakeTouched).touched = now; | ||
} | ||
for (const observedInboundVideoTrack of observedPeerConnection.inboundVideoTracks()) { | ||
const { trackId } = observedInboundVideoTrack; | ||
(0, visitInboundVideoTrack_1.visitInboundVideoTrack)(observedInboundVideoTrack, storedPeerConnection, updatedInboundVideoTracks, reports, fetchSamples); | ||
(0, visitInboundVideoTrack_1.visitInboundVideoTrack)(observedInboundVideoTrack, storedPeerConnection, updatedInboundVideoTracks, reports, fetchSamples, remoteTrackIds.get(trackId), remotePeerConnectionIds.get(trackId), remoteClientIds.get(trackId)); | ||
visitedInboundVideoTrackIds.add(trackId); | ||
((_b = updatedInboundVideoTracks.get(trackId)) !== null && _b !== void 0 ? _b : fakeTouched).touched = now; | ||
} | ||
@@ -60,2 +72,3 @@ for (const observedOutboundAudioTrack of observedPeerConnection.outboundAudioTracks()) { | ||
visitedOutboundAudioTrackIds.add(trackId); | ||
((_c = updatedOutboundAudioTracks.get(trackId)) !== null && _c !== void 0 ? _c : fakeTouched).touched = now; | ||
} | ||
@@ -66,2 +79,3 @@ for (const observedOutboundVideoTrack of observedPeerConnection.outboundVideoTracks()) { | ||
visitedOutboundVideoTrackIds.add(trackId); | ||
((_d = updatedOutboundVideoTracks.get(trackId)) !== null && _d !== void 0 ? _d : fakeTouched).touched = now; | ||
} | ||
@@ -71,87 +85,2 @@ } | ||
} | ||
for (const [peerConnectionId, peerConnection] of Array.from(updatedPeerConnections.entries())) { | ||
if (visitedPeerConnectionIds.has(peerConnectionId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId } = peerConnection; | ||
if (!serviceId || !callId || !clientId) { | ||
continue; | ||
} | ||
const storedClient = clients.get(clientId); | ||
updatedPeerConnections.delete(peerConnectionId); | ||
deletedPeerConnections.add(peerConnectionId); | ||
// also update the client model | ||
if (storedClient) { | ||
storedClient.peerConnectionIds = storedClient.peerConnectionIds.filter((pcId) => pcId !== peerConnectionId); | ||
} | ||
} | ||
for (const [trackId, inboundAudioTrack] of Array.from(updatedInboundAudioTracks.entries())) { | ||
if (visitedInboundAudioTrackIds.has(trackId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId, peerConnectionId } = inboundAudioTrack; | ||
if (!serviceId || !callId || !clientId || !peerConnectionId) { | ||
continue; | ||
} | ||
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId); | ||
updatedInboundAudioTracks.delete(peerConnectionId); | ||
deletedInboundAudioTracks.add(peerConnectionId); | ||
// also update the peer connection model | ||
if (storedPeerConnection) { | ||
storedPeerConnection.inboundTrackIds = storedPeerConnection.inboundTrackIds.filter((tId) => tId !== trackId); | ||
} | ||
} | ||
for (const [trackId, inboundVideoTrack] of Array.from(updatedInboundVideoTracks.entries())) { | ||
if (visitedInboundVideoTrackIds.has(trackId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId, peerConnectionId } = inboundVideoTrack; | ||
if (!serviceId || !callId || !clientId || !peerConnectionId) { | ||
continue; | ||
} | ||
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId); | ||
updatedInboundVideoTracks.delete(peerConnectionId); | ||
deletedInboundVideoTracks.add(peerConnectionId); | ||
// also update the peer connection model | ||
if (storedPeerConnection) { | ||
storedPeerConnection.inboundTrackIds = storedPeerConnection.inboundTrackIds.filter((tId) => tId !== trackId); | ||
} | ||
} | ||
for (const [trackId, OutboundAudioTrack] of Array.from(updatedOutboundAudioTracks.entries())) { | ||
if (visitedOutboundAudioTrackIds.has(trackId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId, peerConnectionId } = OutboundAudioTrack; | ||
if (!serviceId || !callId || !clientId || !peerConnectionId) { | ||
continue; | ||
} | ||
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId); | ||
updatedOutboundAudioTracks.delete(peerConnectionId); | ||
deletedOutboundAudioTracks.add(peerConnectionId); | ||
// also update the peer connection model | ||
if (storedPeerConnection) { | ||
storedPeerConnection.outboundTrackIds = storedPeerConnection.outboundTrackIds.filter((tId) => tId !== trackId); | ||
} | ||
} | ||
for (const [trackId, OutboundVideoTrack] of Array.from(updatedOutboundVideoTracks.entries())) { | ||
if (visitedOutboundVideoTrackIds.has(trackId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId, peerConnectionId } = OutboundVideoTrack; | ||
if (!serviceId || !callId || !clientId || !peerConnectionId) { | ||
continue; | ||
} | ||
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId); | ||
updatedOutboundVideoTracks.delete(peerConnectionId); | ||
deletedOutboundVideoTracks.add(peerConnectionId); | ||
// also update the peer connection model | ||
if (storedPeerConnection) { | ||
storedPeerConnection.outboundTrackIds = storedPeerConnection.outboundTrackIds.filter((tId) => tId !== trackId); | ||
} | ||
} | ||
}; | ||
@@ -158,0 +87,0 @@ const result = async (context, next) => { |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; | ||
const { mediaUnitId, clientId } = observedClient; | ||
const { mediaUnitId, clientId, userId } = observedClient; | ||
const { callId, serviceId, roomId } = observedClient.call; | ||
@@ -23,3 +23,3 @@ for (const clientSample of observedClient.samples()) { | ||
payload: clientSample.os, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -37,3 +37,3 @@ } | ||
payload: clientSample.engine, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -52,3 +52,3 @@ } | ||
payload: clientSample.platform, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -66,3 +66,3 @@ } | ||
payload: clientSample.browser, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -75,3 +75,3 @@ } | ||
payload: mediaConstraint, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -85,3 +85,3 @@ } | ||
payload: localSDP, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -98,2 +98,3 @@ } | ||
clientId, | ||
userId, | ||
timestamp: Date.now(), | ||
@@ -113,2 +114,3 @@ payload: extensionStats.payload, | ||
clientId, | ||
userId, | ||
timestamp: Date.now(), | ||
@@ -124,3 +126,3 @@ ...callEvent, | ||
payload: userMediaError, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -134,3 +136,3 @@ } | ||
payload: certificate, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -144,3 +146,3 @@ } | ||
payload: codec, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -154,3 +156,3 @@ } | ||
payload: iceServer, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -164,3 +166,3 @@ } | ||
payload: mediaDevice, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -174,3 +176,3 @@ } | ||
payload: mediaSource, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -177,0 +179,0 @@ } |
import * as Models from '../../models/Models'; | ||
import { ReportsCollector } from '../../common/ReportsCollector'; | ||
import { ObservedInboundAudioTrack } from '../../samples/ObservedInboundAudioTrack'; | ||
export declare function visitInboundAudioTrack(observedInboundAudioTrack: ObservedInboundAudioTrack, storedPeerConnection: Models.PeerConnection, storedInboundTracks: Map<string, Models.InboundTrack>, reports: ReportsCollector, fetchSamples: boolean): void; | ||
export declare function visitInboundAudioTrack(observedInboundAudioTrack: ObservedInboundAudioTrack, storedPeerConnection: Models.PeerConnection, storedInboundTracks: Map<string, Models.InboundTrack>, reports: ReportsCollector, fetchSamples: boolean, remoteTrackId?: string, remotePeerConnectionId?: string, remoteClientId?: string): void; | ||
//# sourceMappingURL=visitInboundAudioTrack.d.ts.map |
@@ -30,4 +30,4 @@ "use strict"; | ||
const samples_pb_1 = require("../../models/samples_pb"); | ||
function visitInboundAudioTrack(observedInboundAudioTrack, storedPeerConnection, storedInboundTracks, reports, fetchSamples) { | ||
const { trackId } = observedInboundAudioTrack; | ||
function visitInboundAudioTrack(observedInboundAudioTrack, storedPeerConnection, storedInboundTracks, reports, fetchSamples, remoteTrackId, remotePeerConnectionId, remoteClientId) { | ||
const { trackId, sfuStreamId, sfuSinkId } = observedInboundAudioTrack; | ||
const { peerConnectionId } = observedInboundAudioTrack.peerConnection; | ||
@@ -43,5 +43,8 @@ const { mediaUnitId, clientId, userId, marker, minTimestamp: timestamp, } = observedInboundAudioTrack.peerConnection.client; | ||
clientId, | ||
kind: 'audio', | ||
peerConnectionId, | ||
mediaUnitId, | ||
trackId, | ||
sfuSinkId, | ||
sfuStreamId, | ||
userId, | ||
@@ -65,2 +68,3 @@ marker, | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -71,2 +75,5 @@ peerConnectionId, | ||
sampleSeq: -1, | ||
remoteClientId, | ||
remotePeerConnectionId, | ||
remoteTrackId, | ||
}; | ||
@@ -90,4 +97,5 @@ reports.addInboundAudioTrackReport(report); | ||
} | ||
storedInboundAudioTrack.ssrc = [...statsMap.keys()]; | ||
storedInboundAudioTrack.videoStats = Array.from(statsMap.values()); | ||
} | ||
exports.visitInboundAudioTrack = visitInboundAudioTrack; |
import { ReportsCollector } from '../../common/ReportsCollector'; | ||
import { ObservedInboundVideoTrack } from '../../samples/ObservedInboundVideoTrack'; | ||
import * as Models from '../../models/Models'; | ||
export declare function visitInboundVideoTrack(observedInboundVideoTrack: ObservedInboundVideoTrack, storedPeerConnection: Models.PeerConnection, storedInboundTracks: Map<string, Models.InboundTrack>, reports: ReportsCollector, fetchSamples: boolean): void; | ||
export declare function visitInboundVideoTrack(observedInboundVideoTrack: ObservedInboundVideoTrack, storedPeerConnection: Models.PeerConnection, storedInboundTracks: Map<string, Models.InboundTrack>, reports: ReportsCollector, fetchSamples: boolean, remoteTrackId?: string, remotePeerConnectionId?: string, remoteClientId?: string): void; | ||
//# sourceMappingURL=visitInboundVideoTrack.d.ts.map |
@@ -31,4 +31,4 @@ "use strict"; | ||
// InboundVideoTrack visitor | ||
function visitInboundVideoTrack(observedInboundVideoTrack, storedPeerConnection, storedInboundTracks, reports, fetchSamples) { | ||
const { trackId } = observedInboundVideoTrack; | ||
function visitInboundVideoTrack(observedInboundVideoTrack, storedPeerConnection, storedInboundTracks, reports, fetchSamples, remoteTrackId, remotePeerConnectionId, remoteClientId) { | ||
const { trackId, sfuStreamId, sfuSinkId } = observedInboundVideoTrack; | ||
const { peerConnectionId } = observedInboundVideoTrack.peerConnection; | ||
@@ -44,5 +44,8 @@ const { mediaUnitId, clientId, userId, marker, minTimestamp: timestamp, } = observedInboundVideoTrack.peerConnection.client; | ||
clientId, | ||
kind: 'video', | ||
peerConnectionId, | ||
mediaUnitId, | ||
trackId, | ||
sfuStreamId, | ||
sfuSinkId, | ||
userId, | ||
@@ -66,2 +69,3 @@ marker, | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -72,2 +76,5 @@ peerConnectionId, | ||
sampleSeq: -1, | ||
remoteClientId, | ||
remotePeerConnectionId, | ||
remoteTrackId, | ||
}; | ||
@@ -92,4 +99,5 @@ reports.addInboundVideoTrackReport(report); | ||
} | ||
storedInboundVideoTrack.ssrc = [...statsMap.keys()]; | ||
storedInboundVideoTrack.videoStats = Array.from(statsMap.values()); | ||
} | ||
exports.visitInboundVideoTrack = visitInboundVideoTrack; |
@@ -31,3 +31,3 @@ "use strict"; | ||
function visitOutboundAudioTrack(observedOutboundAudioTrack, storedPeerConnection, storedOutboundTracks, reports, fetchSamples) { | ||
const { trackId } = observedOutboundAudioTrack; | ||
const { trackId, sfuStreamId } = observedOutboundAudioTrack; | ||
const { peerConnectionId } = observedOutboundAudioTrack.peerConnection; | ||
@@ -43,5 +43,7 @@ const { mediaUnitId, clientId, userId, marker, minTimestamp: timestamp, } = observedOutboundAudioTrack.peerConnection.client; | ||
clientId, | ||
kind: 'audio', | ||
peerConnectionId, | ||
mediaUnitId, | ||
trackId, | ||
sfuStreamId, | ||
userId, | ||
@@ -65,2 +67,3 @@ marker, | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -87,4 +90,5 @@ peerConnectionId, | ||
} | ||
storedOutboundAudioTrack.ssrc = [...statsMap.keys()]; | ||
storedOutboundAudioTrack.audioStats = Array.from(statsMap.values()); | ||
} | ||
exports.visitOutboundAudioTrack = visitOutboundAudioTrack; |
@@ -31,3 +31,3 @@ "use strict"; | ||
function visitOutboundVideoTrack(observedOutboundVideoTrack, storedPeerConnection, storedOutboundTracks, reports, fetchSamples) { | ||
const { trackId } = observedOutboundVideoTrack; | ||
const { trackId, sfuStreamId } = observedOutboundVideoTrack; | ||
const { peerConnectionId } = observedOutboundVideoTrack.peerConnection; | ||
@@ -43,5 +43,7 @@ const { mediaUnitId, clientId, userId, marker, minTimestamp: timestamp, } = observedOutboundVideoTrack.peerConnection.client; | ||
clientId, | ||
kind: 'video', | ||
peerConnectionId, | ||
mediaUnitId, | ||
trackId, | ||
sfuStreamId, | ||
userId, | ||
@@ -65,2 +67,3 @@ marker, | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -88,4 +91,5 @@ peerConnectionId, | ||
} | ||
storedOutboundVideoTrack.ssrc = [...statsMap.keys()]; | ||
storedOutboundVideoTrack.videoStats = Array.from(statsMap.values()); | ||
} | ||
exports.visitOutboundVideoTrack = visitOutboundVideoTrack; |
@@ -62,2 +62,3 @@ "use strict"; | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -70,2 +71,16 @@ ...pcTransport, | ||
} | ||
for (const iceCandidatePair of observedPeerConnection.iceCandidatePairs()) { | ||
const report = { | ||
serviceId, | ||
roomId, | ||
callId, | ||
userId, | ||
clientId, | ||
mediaUnitId, | ||
...iceCandidatePair, | ||
timestamp, | ||
sampleSeq: -1, // deprecated | ||
}; | ||
reports.addIceCandidatePairReport(report); | ||
} | ||
if (fetchSamples) { | ||
@@ -72,0 +87,0 @@ storedPeerConnection.icelocalCandidates = []; |
@@ -178,2 +178,6 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; | ||
transports: Samples_ClientSample_PeerConnectionTransport[]; | ||
/** | ||
* @generated from field: optional uint64 touched = 17; | ||
*/ | ||
touched?: bigint; | ||
constructor(data?: PartialMessage<PeerConnection>); | ||
@@ -245,9 +249,17 @@ static readonly runtime: typeof proto2; | ||
/** | ||
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundAudioTrack audioStats = 14; | ||
* @generated from field: repeated int64 ssrc = 14; | ||
*/ | ||
ssrc: bigint[]; | ||
/** | ||
* @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 = 15; | ||
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack videoStats = 16; | ||
*/ | ||
videoStats: Samples_ClientSample_InboundVideoTrack[]; | ||
/** | ||
* @generated from field: optional uint64 touched = 17; | ||
*/ | ||
touched?: bigint; | ||
constructor(data?: PartialMessage<InboundTrack>); | ||
@@ -326,2 +338,6 @@ static readonly runtime: typeof proto2; | ||
videoStats: Samples_ClientSample_OutboundVideoTrack[]; | ||
/** | ||
* @generated from field: optional uint64 touched = 16; | ||
*/ | ||
touched?: bigint; | ||
constructor(data?: PartialMessage<OutboundTrack>); | ||
@@ -434,5 +450,5 @@ static readonly runtime: typeof proto2; | ||
/** | ||
* @generated from field: optional uint64 serverTouched = 12; | ||
* @generated from field: optional uint64 touched = 12; | ||
*/ | ||
serverTouched?: bigint; | ||
touched?: bigint; | ||
constructor(data?: PartialMessage<SfuTransport>); | ||
@@ -484,5 +500,5 @@ static readonly runtime: typeof proto2; | ||
/** | ||
* @generated from field: optional uint64 sampleTouched = 9; | ||
* @generated from field: optional uint64 touched = 9; | ||
*/ | ||
sampleTouched?: bigint; | ||
touched?: bigint; | ||
/** | ||
@@ -496,6 +512,2 @@ * @generated from field: optional string mediaUnitId = 10; | ||
marker?: string; | ||
/** | ||
* @generated from field: optional uint64 serverTouched = 12; | ||
*/ | ||
serverTouched?: bigint; | ||
constructor(data?: PartialMessage<SfuInboundRtpPad>); | ||
@@ -551,5 +563,5 @@ static readonly runtime: typeof proto2; | ||
/** | ||
* @generated from field: optional uint64 sampleTouched = 10; | ||
* @generated from field: optional uint64 touched = 10; | ||
*/ | ||
sampleTouched?: bigint; | ||
touched?: bigint; | ||
/** | ||
@@ -563,6 +575,2 @@ * @generated from field: optional string mediaUnitId = 11; | ||
marker?: string; | ||
/** | ||
* @generated from field: optional uint64 serverTouched = 13; | ||
*/ | ||
serverTouched?: bigint; | ||
constructor(data?: PartialMessage<SfuOutboundRtpPad>); | ||
@@ -606,5 +614,5 @@ static readonly runtime: typeof proto2; | ||
/** | ||
* @generated from field: optional uint64 sampleTouched = 7; | ||
* @generated from field: optional uint64 touched = 7; | ||
*/ | ||
sampleTouched?: bigint; | ||
touched?: bigint; | ||
/** | ||
@@ -618,6 +626,2 @@ * @generated from field: optional string mediaUnitId = 8; | ||
marker?: string; | ||
/** | ||
* @generated from field: optional uint64 serverTouched = 10; | ||
*/ | ||
serverTouched?: bigint; | ||
constructor(data?: PartialMessage<SfuSctpChannel>); | ||
@@ -624,0 +628,0 @@ static readonly runtime: typeof proto2; |
@@ -155,2 +155,3 @@ "use strict"; | ||
{ 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 }, | ||
]); | ||
@@ -164,7 +165,11 @@ /** | ||
/** | ||
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundAudioTrack audioStats = 14; | ||
* @generated from field: repeated int64 ssrc = 14; | ||
*/ | ||
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 = 15; | ||
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack videoStats = 16; | ||
*/ | ||
@@ -204,4 +209,6 @@ this.videoStats = []; | ||
{ no: 13, name: "sfuStreamId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 14, name: "audioStats", kind: "message", T: samples_pb_1.Samples_ClientSample_InboundAudioTrack, repeated: true }, | ||
{ no: 15, name: "videoStats", kind: "message", T: samples_pb_1.Samples_ClientSample_InboundVideoTrack, repeated: true }, | ||
{ 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 }, | ||
]); | ||
@@ -260,2 +267,3 @@ /** | ||
{ 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 }, | ||
]); | ||
@@ -349,3 +357,3 @@ /** | ||
{ no: 11, name: "sctpChannelIds", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, | ||
{ no: 12, name: "serverTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 12, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -385,6 +393,5 @@ /** | ||
{ no: 8, name: "added", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
{ no: 9, name: "sampleTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 9, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 10, name: "mediaUnitId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 11, name: "marker", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 12, name: "serverTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -425,6 +432,5 @@ /** | ||
{ no: 9, name: "added", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
{ no: 10, name: "sampleTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 10, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 11, name: "mediaUnitId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 12, name: "marker", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 13, name: "serverTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -462,6 +468,5 @@ /** | ||
{ no: 6, name: "opened", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
{ no: 7, name: "sampleTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 7, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 8, name: "mediaUnitId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 9, name: "marker", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 10, name: "serverTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); |
@@ -23,2 +23,3 @@ "use strict"; | ||
fetchSamples: true, | ||
maxIdleTimeInMs: 300 * 1000, | ||
}, | ||
@@ -25,0 +26,0 @@ sink: {}, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ObservedCallsBuilder = void 0; | ||
const utils_1 = require("../common/utils"); | ||
const ObservedCall_1 = require("./ObservedCall"); | ||
@@ -21,3 +22,3 @@ class ObservedCallsBuilder { | ||
const observedCalls = new Map(); | ||
const callIds = function* () { | ||
const callIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -27,3 +28,4 @@ yield observedCall.callId; | ||
}; | ||
const clientIds = function* () { | ||
const callIds = () => (0, utils_1.iteratorConverter)(callIdsGenerator()); | ||
const clientIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -35,3 +37,4 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const peerConnectionIds = function* () { | ||
const clientIds = () => (0, utils_1.iteratorConverter)(clientIdsGenerator()); | ||
const peerConnectionIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -45,3 +48,4 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const inboundAudioTrackIds = function* () { | ||
const peerConnectionIds = () => (0, utils_1.iteratorConverter)(peerConnectionIdsGenerator()); | ||
const inboundAudioTrackIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -57,3 +61,4 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const inboundVideoTrackIds = function* () { | ||
const inboundAudioTrackIds = () => (0, utils_1.iteratorConverter)(inboundAudioTrackIdsGenerator()); | ||
const inboundVideoTrackIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -69,3 +74,4 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const outboundAudioTrackIds = function* () { | ||
const inboundVideoTrackIds = () => (0, utils_1.iteratorConverter)(inboundVideoTrackIdsGenerator()); | ||
const outboundAudioTrackIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -81,3 +87,4 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const outboundVideoTrackIds = function* () { | ||
const outboundAudioTrackIds = () => (0, utils_1.iteratorConverter)(outboundAudioTrackIdsGenerator()); | ||
const outboundVideoTrackIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -93,2 +100,3 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const outboundVideoTrackIds = () => (0, utils_1.iteratorConverter)(outboundVideoTrackIdsGenerator()); | ||
const result = { | ||
@@ -109,2 +117,3 @@ callIds, | ||
} | ||
this._builders.clear(); | ||
return result; | ||
@@ -111,0 +120,0 @@ } |
@@ -6,2 +6,4 @@ import { InboundAudioTrack } from '@observertc/sample-schemas-js'; | ||
readonly trackId: string; | ||
readonly sfuStreamId?: string; | ||
readonly sfuSinkId?: string; | ||
samples(): IterableIterator<InboundAudioTrack>; | ||
@@ -8,0 +10,0 @@ } |
@@ -6,2 +6,4 @@ import { InboundVideoTrack } from '@observertc/sample-schemas-js'; | ||
readonly trackId: string; | ||
readonly sfuStreamId?: string; | ||
readonly sfuSinkId?: string; | ||
samples(): IterableIterator<InboundVideoTrack>; | ||
@@ -8,0 +10,0 @@ } |
@@ -6,2 +6,3 @@ import { OutboundAudioTrack } from '@observertc/sample-schemas-js'; | ||
readonly trackId: string; | ||
readonly sfuStreamId?: string; | ||
samples(): IterableIterator<OutboundAudioTrack>; | ||
@@ -8,0 +9,0 @@ } |
@@ -6,2 +6,3 @@ import { OutboundVideoTrack } from '@observertc/sample-schemas-js'; | ||
readonly trackId: string; | ||
readonly sfuStreamId?: string; | ||
samples(): IterableIterator<OutboundVideoTrack>; | ||
@@ -8,0 +9,0 @@ } |
@@ -28,3 +28,3 @@ "use strict"; | ||
if (inboundAudioTrackSample.trackId) { | ||
const builder = this._getInboundAudioTrackBuilder(inboundAudioTrackSample.trackId); | ||
const builder = this._getInboundAudioTrackBuilder(inboundAudioTrackSample.trackId, inboundAudioTrackSample.sfuStreamId, inboundAudioTrackSample.sfuSinkId); | ||
builder.addSample(inboundAudioTrackSample); | ||
@@ -42,3 +42,3 @@ } | ||
} | ||
_getInboundAudioTrackBuilder(trackId) { | ||
_getInboundAudioTrackBuilder(trackId, sfuStreamId, sfuSinkId) { | ||
let result = this._inboundAudioTracks.get(trackId); | ||
@@ -48,2 +48,4 @@ if (!result) { | ||
trackId, | ||
sfuStreamId, | ||
sfuSinkId, | ||
}); | ||
@@ -56,7 +58,7 @@ this._inboundAudioTracks.set(trackId, result); | ||
if (outboundAudioTrackSample.trackId) { | ||
const builder = this._getOutboundAudioTrackBuilder(outboundAudioTrackSample.trackId); | ||
const builder = this._getOutboundAudioTrackBuilder(outboundAudioTrackSample.trackId, outboundAudioTrackSample.sfuStreamId); | ||
builder.addSample(outboundAudioTrackSample); | ||
} | ||
} | ||
_getOutboundAudioTrackBuilder(trackId) { | ||
_getOutboundAudioTrackBuilder(trackId, sfuStreamId) { | ||
let result = this._outboundAudioTracks.get(trackId); | ||
@@ -66,2 +68,3 @@ if (!result) { | ||
trackId, | ||
sfuStreamId | ||
}); | ||
@@ -74,7 +77,7 @@ this._outboundAudioTracks.set(trackId, result); | ||
if (inboundVideoTrackSample.trackId) { | ||
const builder = this._getInboundVideoTrackBuilder(inboundVideoTrackSample.trackId); | ||
const builder = this._getInboundVideoTrackBuilder(inboundVideoTrackSample.trackId, inboundVideoTrackSample.sfuStreamId, inboundVideoTrackSample.sfuSinkId); | ||
builder.addSample(inboundVideoTrackSample); | ||
} | ||
} | ||
_getInboundVideoTrackBuilder(trackId) { | ||
_getInboundVideoTrackBuilder(trackId, sfuStreamId, sfuSinkId) { | ||
let result = this._inboundVideoTracks.get(trackId); | ||
@@ -84,2 +87,4 @@ if (!result) { | ||
trackId, | ||
sfuStreamId, | ||
sfuSinkId, | ||
}); | ||
@@ -92,7 +97,7 @@ this._inboundVideoTracks.set(trackId, result); | ||
if (outboundVideoTrackSample.trackId) { | ||
const builder = this._getOutboundVideoTrackBuilder(outboundVideoTrackSample.trackId); | ||
const builder = this._getOutboundVideoTrackBuilder(outboundVideoTrackSample.trackId, outboundVideoTrackSample.sfuStreamId); | ||
builder.addSample(outboundVideoTrackSample); | ||
} | ||
} | ||
_getOutboundVideoTrackBuilder(trackId) { | ||
_getOutboundVideoTrackBuilder(trackId, sfuStreamId) { | ||
let result = this._outboundVideoTracks.get(trackId); | ||
@@ -102,2 +107,3 @@ if (!result) { | ||
trackId, | ||
sfuStreamId, | ||
}); | ||
@@ -104,0 +110,0 @@ this._outboundVideoTracks.set(trackId, result); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ObservedSfusBuilder = void 0; | ||
const utils_1 = require("../common/utils"); | ||
const ObservedSfu_1 = require("./ObservedSfu"); | ||
@@ -21,3 +22,3 @@ class ObservedSfusBuilder { | ||
const observedSfus = new Map(); | ||
const sfuIds = function* () { | ||
const sfuIdsGenerator = function* () { | ||
for (const observedSfu of observedSfus.values()) { | ||
@@ -27,3 +28,4 @@ yield observedSfu.sfuId; | ||
}; | ||
const sfuTransportIds = function* () { | ||
const sfuIds = () => (0, utils_1.iteratorConverter)(sfuIdsGenerator()); | ||
const sfuTransportIdsGenerator = function* () { | ||
for (const observedSfu of observedSfus.values()) { | ||
@@ -35,3 +37,4 @@ for (const observedTransport of observedSfu.observedSfuTransports()) { | ||
}; | ||
const sfuInboundRtpPadIds = function* () { | ||
const sfuTransportIds = () => (0, utils_1.iteratorConverter)(sfuTransportIdsGenerator()); | ||
const sfuInboundRtpPadIdsGenerator = function* () { | ||
for (const observedSfu of observedSfus.values()) { | ||
@@ -45,3 +48,4 @@ for (const observedTransport of observedSfu.observedSfuTransports()) { | ||
}; | ||
const sfuOutboundRtpPadIds = function* () { | ||
const sfuInboundRtpPadIds = () => (0, utils_1.iteratorConverter)(sfuInboundRtpPadIdsGenerator()); | ||
const sfuOutboundRtpPadIdsGenerator = function* () { | ||
for (const observedSfu of observedSfus.values()) { | ||
@@ -55,2 +59,3 @@ for (const observedTransport of observedSfu.observedSfuTransports()) { | ||
}; | ||
const sfuOutboundRtpPadIds = () => (0, utils_1.iteratorConverter)(sfuOutboundRtpPadIdsGenerator()); | ||
const result = { | ||
@@ -68,2 +73,3 @@ sfuIds, | ||
} | ||
this._builders.clear(); | ||
return result; | ||
@@ -70,0 +76,0 @@ } |
@@ -82,3 +82,7 @@ /** | ||
[Symbol.asyncIterator](): AsyncIterableIterator<[K, V]>; | ||
/** | ||
* Returns an iterable iterator for the key-value pairs stored in this local instance of the storage. | ||
*/ | ||
localEntries(): IterableIterator<[K, V]>; | ||
} | ||
//# sourceMappingURL=ObserverStorage.d.ts.map |
@@ -17,3 +17,4 @@ import { ObserverStorage } from './ObserverStorage'; | ||
[Symbol.asyncIterator](): AsyncIterableIterator<[K, V]>; | ||
localEntries(): IterableIterator<[K, V]>; | ||
} | ||
//# sourceMappingURL=SimpleStorage.d.ts.map |
@@ -85,3 +85,6 @@ "use strict"; | ||
} | ||
localEntries() { | ||
return this._map.entries(); | ||
} | ||
} | ||
exports.SimpleStorage = SimpleStorage; |
{ | ||
"name": "@observertc/observer-js", | ||
"version": "0.9.11-beta", | ||
"version": "0.9.12-beta", | ||
"description": "Server Side NodeJS Library for processing ObserveRTC Samples", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -85,2 +85,3 @@ import { CallMetaReport } from '@observertc/report-schemas-js'; | ||
reportType: CallMetaReportType, | ||
userId?: string, | ||
timestamp?: number | ||
@@ -95,2 +96,3 @@ ) { | ||
clientId, | ||
userId, | ||
payload: JSON.stringify(reportType.payload), | ||
@@ -97,0 +99,0 @@ timestamp: timestamp ?? Date.now(), |
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; | ||
export type Writable<T> = T extends object ? { -readonly [K in keyof T]: Writable<T[K]> } : T; | ||
export function iteratorConverter<T>(generator: Generator<T, void, undefined>): IterableIterator<T> { | ||
return { | ||
[Symbol.iterator](): IterableIterator<T> { | ||
return this; | ||
}, | ||
next(): IteratorResult<T> { | ||
return generator.next(); | ||
}, | ||
} | ||
} |
@@ -24,2 +24,4 @@ import { createLogger } from './common/logger'; | ||
fetchSamples: boolean; | ||
maxIdleTimeInMs?: number, | ||
findRemoteMatches?: boolean, | ||
}; | ||
@@ -54,3 +56,5 @@ | ||
_reportsCollector, | ||
this.config.fetchSamples | ||
this.config.fetchSamples, | ||
BigInt(this.config.maxIdleTimeInMs ?? 10000), | ||
this.config.findRemoteMatches, | ||
); | ||
@@ -111,3 +115,3 @@ | ||
const { observedCalls, observedSfus } = samples; | ||
const evaluatorContext: EvaluatorContext = { | ||
@@ -148,3 +152,3 @@ observedCalls, | ||
}; | ||
const callOperations = createCallOperationContext(this._clientOperations, evaluatorContext); | ||
@@ -151,0 +155,0 @@ this._clientOperations.clear(); |
@@ -70,37 +70,69 @@ import { StorageProvider } from '../storages/StorageProvider'; | ||
const [clients, sfus] = await Promise.all([clientStorage.getAll(observedCalls.clientIds()), sfuStorage.getAll([])]); | ||
const [ | ||
[ | ||
clients, | ||
peerConnections, | ||
inboundAudioTrackEntries, | ||
inboundVideoTrackEntries, | ||
outboundAudioTrackEntries, | ||
outboundVideoTrackEntries, | ||
], | ||
[ | ||
sfus, | ||
sfuTransports, | ||
sfuInboundRtpPads, | ||
sfuOutboundRtpPads, | ||
sfuSctpChannels | ||
] | ||
] = await Promise.all([ | ||
Promise.all([ | ||
clientStorage.getAll(observedCalls.clientIds()), | ||
peerConnectionStorage.getAll(observedCalls.peerConnectionIds()), | ||
inboundTrackStorage.getAll(observedCalls.inboundAudioTrackIds()), | ||
inboundTrackStorage.getAll(observedCalls.inboundVideoTrackIds()), | ||
outboundTrackStorage.getAll(observedCalls.outboundAudioTrackIds()), | ||
outboundTrackStorage.getAll(observedCalls.outboundVideoTrackIds()), | ||
]), | ||
Promise.all([ | ||
sfuStorage.getAll(observedSfus.sfuIds()), | ||
sfuTransportStorage.getAll(observedSfus.sfuTransportIds()), | ||
sfuInboundRtpPadStorage.getAll(observedCalls.peerConnectionIds()), | ||
sfuOutboundRtpPadStorage.getAll(observedCalls.peerConnectionIds()), | ||
sfuSctpChannelStorage.getAll(observedCalls.peerConnectionIds()), | ||
]) | ||
]); | ||
const peerConnectionIds = Array.from(clients.values()).flatMap((client) => client.peerConnectionIds); | ||
// const peerConnectionIds = Array.from(clients.values()).flatMap((client) => client.peerConnectionIds); | ||
const sfuTransportIds = Array.from(sfus.values()).flatMap((sfu) => sfu.sfuTransportIds); | ||
// const sfuTransportIds = Array.from(sfus.values()).flatMap((sfu) => sfu.sfuTransportIds); | ||
const [peerConnections, sfuTransports] = await Promise.all([ | ||
peerConnectionStorage.getAll(peerConnectionIds), | ||
sfuTransportStorage.getAll(sfuTransportIds), | ||
]); | ||
// const [peerConnections, sfuTransports] = await Promise.all([ | ||
// peerConnectionStorage.getAll(peerConnectionIds), | ||
// sfuTransportStorage.getAll(sfuTransportIds), | ||
// ]); | ||
const peerConnectionValues = Array.from(peerConnections.values()); | ||
const inboundTrackIds = peerConnectionValues.flatMap((pc) => pc.inboundTrackIds); | ||
const outboundTrackIds = peerConnectionValues.flatMap((pc) => pc.outboundTrackIds); | ||
// const peerConnectionValues = Array.from(peerConnections.values()); | ||
// const inboundTrackIds = peerConnectionValues.flatMap((pc) => pc.inboundTrackIds); | ||
// const outboundTrackIds = peerConnectionValues.flatMap((pc) => pc.outboundTrackIds); | ||
const sfuTransportValues = Array.from(sfuTransports.values()); | ||
const sfuInboundRtpPadIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.inboundRtpPadIds); | ||
const sfuOutboundRtpPadIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.outboundRtpPadIds); | ||
const sfuSctpChannelIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.sctpChannelIds); | ||
// const sfuTransportValues = Array.from(sfuTransports.values()); | ||
// const sfuInboundRtpPadIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.inboundRtpPadIds); | ||
// const sfuOutboundRtpPadIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.outboundRtpPadIds); | ||
// const sfuSctpChannelIds = sfuTransportValues.flatMap((sfuTransport) => sfuTransport.sctpChannelIds); | ||
const [inboundTracks, outboundTracks, sfuInboundRtpPads, sfuOutboundRtpPads, sfuSctpChannels] = await Promise.all([ | ||
inboundTrackStorage.getAll(inboundTrackIds), | ||
outboundTrackStorage.getAll(outboundTrackIds), | ||
sfuInboundRtpPadStorage.getAll(sfuInboundRtpPadIds), | ||
sfuOutboundRtpPadStorage.getAll(sfuOutboundRtpPadIds), | ||
sfuSctpChannelStorage.getAll(sfuSctpChannelIds), | ||
]); | ||
// const [inboundTracks, outboundTracks, sfuInboundRtpPads, sfuOutboundRtpPads, sfuSctpChannels] = await Promise.all([ | ||
// inboundTrackStorage.getAll(inboundTrackIds), | ||
// outboundTrackStorage.getAll(outboundTrackIds), | ||
// sfuInboundRtpPadStorage.getAll(sfuInboundRtpPadIds), | ||
// sfuOutboundRtpPadStorage.getAll(sfuOutboundRtpPadIds), | ||
// sfuSctpChannelStorage.getAll(sfuSctpChannelIds), | ||
// ]); | ||
const inboundTrackEntries = Array.from(inboundTracks); | ||
const outboundTrackEntries = Array.from(outboundTracks); | ||
// const inboundTrackEntries = Array.from(inboundTracks); | ||
// const outboundTrackEntries = Array.from(outboundTracks); | ||
const inboundAudioTrackEntries = inboundTrackEntries.filter((e) => e[1].kind === 'audio'); | ||
const inboundVideoTrackEntries = inboundTrackEntries.filter((e) => e[1].kind === 'video'); | ||
const outboundAudioTrackEntries = outboundTrackEntries.filter((e) => e[1].kind === 'audio'); | ||
const outboundVideoTrackEntries = outboundTrackEntries.filter((e) => e[1].kind === 'video'); | ||
// const inboundAudioTrackEntries = inboundTrackEntries.filter((e) => e[1].kind === 'audio'); | ||
// const inboundVideoTrackEntries = inboundTrackEntries.filter((e) => e[1].kind === 'video'); | ||
// const outboundAudioTrackEntries = outboundTrackEntries.filter((e) => e[1].kind === 'audio'); | ||
// const outboundVideoTrackEntries = outboundTrackEntries.filter((e) => e[1].kind === 'video'); | ||
@@ -107,0 +139,0 @@ const transactionContext: TransactionContext = { |
import { ReportsCollector } from '../common/ReportsCollector'; | ||
import { StorageProvider } from '../storages/StorageProvider'; | ||
import { createCommitTransactionMiddleware } from './CommitTransactionMiddleware'; | ||
import { createDeleteOutdatedCallEntries } from './DeleteOutdatedCallEntries'; | ||
import { createDeleteOutdatedSfuEntries } from './DeleteOutdatedSfuEntries'; | ||
import { Processor, createProcessor } from './Processor'; | ||
@@ -12,8 +14,12 @@ import { TransactionContext } from './TransactionContext'; | ||
reportsCollector: ReportsCollector, | ||
fetchSamples: boolean | ||
fetchSamples: boolean, | ||
maxIdleTimeInMs: BigInt, | ||
findRemoteMatches?: boolean, | ||
): Processor<TransactionContext> { | ||
return createProcessor( | ||
// all of these middlewares must execute sequentially! | ||
createVisitObservedCallsMiddleware(reportsCollector, fetchSamples), | ||
createVisitObservedCallsMiddleware(storageProvider, reportsCollector, fetchSamples, findRemoteMatches), | ||
createVisitObservedSfusMiddleware(reportsCollector, fetchSamples), | ||
createDeleteOutdatedCallEntries(storageProvider, maxIdleTimeInMs), | ||
createDeleteOutdatedSfuEntries(storageProvider, maxIdleTimeInMs), | ||
@@ -20,0 +26,0 @@ // must be the last one! |
@@ -11,8 +11,15 @@ import { Middleware } from './Middleware'; | ||
import { visitInboundVideoTrack } from './visitors/visitInboundVideoTrack'; | ||
import { InboundTrack } from '../models/Models'; | ||
import { StorageProvider } from '../storages/StorageProvider'; | ||
import { findRemoteMatches as findRemoteMatchFunc } from '../processes/findRemoteMatches'; | ||
export const logger = createLogger('VisitObservedCallsMiddleware'); | ||
const emptyMap = new Map(); | ||
export function createVisitObservedCallsMiddleware( | ||
storages: StorageProvider, | ||
reports: ReportsCollector, | ||
fetchSamples: boolean | ||
fetchSamples: boolean, | ||
findRemoteMatches?: boolean, | ||
): Middleware<TransactionContext> { | ||
@@ -24,15 +31,6 @@ const process = async (transaction: TransactionContext) => { | ||
updatedPeerConnections, | ||
deletedPeerConnections, | ||
updatedInboundAudioTracks, | ||
deletedInboundAudioTracks, | ||
updatedInboundVideoTracks, | ||
deletedInboundVideoTracks, | ||
updatedOutboundAudioTracks, | ||
deletedOutboundAudioTracks, | ||
updatedOutboundVideoTracks, | ||
deletedOutboundVideoTracks, | ||
} = transaction; | ||
@@ -45,3 +43,20 @@ | ||
const visitedOutboundVideoTrackIds = new Set<string>(); | ||
const { | ||
remoteTrackIds, | ||
remotePeerConnectionIds, | ||
remoteClientIds | ||
} = !findRemoteMatches ? { | ||
remoteTrackIds: emptyMap, | ||
remotePeerConnectionIds: emptyMap, | ||
remoteClientIds: emptyMap, | ||
} : await findRemoteMatchFunc( | ||
storages, | ||
clients, | ||
new Map<string, InboundTrack>([...updatedInboundAudioTracks, ...updatedInboundVideoTracks]) | ||
) | ||
const now = BigInt(Date.now()); | ||
const fakeTouched = { touched: BigInt(0) }; | ||
for (const observedCall of observedCalls.observedCalls()) { | ||
@@ -54,3 +69,2 @@ const { callId, serviceId, roomId } = observedCall; | ||
// console.warn("dskfjhdkfhsdkf", observedClient, storedClient); | ||
if (!storedClient) { | ||
@@ -68,3 +82,3 @@ // should not happen as client joined must have run before this | ||
); | ||
for (const observedPeerConnection of observedClient.observedPeerConnections()) { | ||
@@ -83,3 +97,4 @@ const { peerConnectionId } = observedPeerConnection; | ||
} | ||
storedPeerConnection.touched = now; | ||
visitedPeerConnectionIds.add(peerConnectionId); | ||
@@ -94,6 +109,10 @@ | ||
reports, | ||
fetchSamples | ||
fetchSamples, | ||
remoteTrackIds.get(trackId), | ||
remotePeerConnectionIds.get(trackId), | ||
remoteClientIds.get(trackId), | ||
); | ||
visitedInboundAudioTrackIds.add(trackId); | ||
(updatedInboundAudioTracks.get(trackId) ?? fakeTouched).touched = now; | ||
} | ||
@@ -109,6 +128,10 @@ | ||
reports, | ||
fetchSamples | ||
fetchSamples, | ||
remoteTrackIds.get(trackId), | ||
remotePeerConnectionIds.get(trackId), | ||
remoteClientIds.get(trackId), | ||
); | ||
visitedInboundVideoTrackIds.add(trackId); | ||
(updatedInboundVideoTracks.get(trackId) ?? fakeTouched).touched = now; | ||
} | ||
@@ -128,2 +151,3 @@ | ||
visitedOutboundAudioTrackIds.add(trackId); | ||
(updatedOutboundAudioTracks.get(trackId) ?? fakeTouched).touched = now; | ||
} | ||
@@ -143,2 +167,3 @@ | ||
visitedOutboundVideoTrackIds.add(trackId); | ||
(updatedOutboundVideoTracks.get(trackId) ?? fakeTouched).touched = now; | ||
} | ||
@@ -148,112 +173,2 @@ } | ||
} | ||
for (const [peerConnectionId, peerConnection] of Array.from(updatedPeerConnections.entries())) { | ||
if (visitedPeerConnectionIds.has(peerConnectionId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId } = peerConnection; | ||
if (!serviceId || !callId || !clientId) { | ||
continue; | ||
} | ||
const storedClient = clients.get(clientId); | ||
updatedPeerConnections.delete(peerConnectionId); | ||
deletedPeerConnections.add(peerConnectionId); | ||
// also update the client model | ||
if (storedClient) { | ||
storedClient.peerConnectionIds = storedClient.peerConnectionIds.filter((pcId) => pcId !== peerConnectionId); | ||
} | ||
} | ||
for (const [trackId, inboundAudioTrack] of Array.from(updatedInboundAudioTracks.entries())) { | ||
if (visitedInboundAudioTrackIds.has(trackId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId, peerConnectionId } = inboundAudioTrack; | ||
if (!serviceId || !callId || !clientId || !peerConnectionId) { | ||
continue; | ||
} | ||
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId); | ||
updatedInboundAudioTracks.delete(peerConnectionId); | ||
deletedInboundAudioTracks.add(peerConnectionId); | ||
// also update the peer connection model | ||
if (storedPeerConnection) { | ||
storedPeerConnection.inboundTrackIds = storedPeerConnection.inboundTrackIds.filter((tId) => tId !== trackId); | ||
} | ||
} | ||
for (const [trackId, inboundVideoTrack] of Array.from(updatedInboundVideoTracks.entries())) { | ||
if (visitedInboundVideoTrackIds.has(trackId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId, peerConnectionId } = inboundVideoTrack; | ||
if (!serviceId || !callId || !clientId || !peerConnectionId) { | ||
continue; | ||
} | ||
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId); | ||
updatedInboundVideoTracks.delete(peerConnectionId); | ||
deletedInboundVideoTracks.add(peerConnectionId); | ||
// also update the peer connection model | ||
if (storedPeerConnection) { | ||
storedPeerConnection.inboundTrackIds = storedPeerConnection.inboundTrackIds.filter((tId) => tId !== trackId); | ||
} | ||
} | ||
for (const [trackId, OutboundAudioTrack] of Array.from(updatedOutboundAudioTracks.entries())) { | ||
if (visitedOutboundAudioTrackIds.has(trackId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId, peerConnectionId } = OutboundAudioTrack; | ||
if (!serviceId || !callId || !clientId || !peerConnectionId) { | ||
continue; | ||
} | ||
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId); | ||
updatedOutboundAudioTracks.delete(peerConnectionId); | ||
deletedOutboundAudioTracks.add(peerConnectionId); | ||
// also update the peer connection model | ||
if (storedPeerConnection) { | ||
storedPeerConnection.outboundTrackIds = storedPeerConnection.outboundTrackIds.filter((tId) => tId !== trackId); | ||
} | ||
} | ||
for (const [trackId, OutboundVideoTrack] of Array.from(updatedOutboundVideoTracks.entries())) { | ||
if (visitedOutboundVideoTrackIds.has(trackId)) { | ||
continue; | ||
} | ||
// delete PeerConnection | ||
const { serviceId, callId, clientId, peerConnectionId } = OutboundVideoTrack; | ||
if (!serviceId || !callId || !clientId || !peerConnectionId) { | ||
continue; | ||
} | ||
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId); | ||
updatedOutboundVideoTracks.delete(peerConnectionId); | ||
deletedOutboundVideoTracks.add(peerConnectionId); | ||
// also update the peer connection model | ||
if (storedPeerConnection) { | ||
storedPeerConnection.outboundTrackIds = storedPeerConnection.outboundTrackIds.filter((tId) => tId !== trackId); | ||
} | ||
} | ||
}; | ||
@@ -260,0 +175,0 @@ const result = async (context: TransactionContext, next?: Middleware<TransactionContext>) => { |
@@ -18,3 +18,3 @@ import { ObservedClient } from '../../samples/ObservedClient'; | ||
) { | ||
const { mediaUnitId, clientId } = observedClient; | ||
const { mediaUnitId, clientId, userId } = observedClient; | ||
@@ -38,3 +38,3 @@ const { callId, serviceId, roomId } = observedClient.call; | ||
payload: clientSample.os, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -56,3 +56,3 @@ } | ||
payload: clientSample.engine, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -75,3 +75,3 @@ } | ||
payload: clientSample.platform, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -93,3 +93,3 @@ } | ||
payload: clientSample.browser, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -103,3 +103,3 @@ } | ||
payload: mediaConstraint, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -115,3 +115,3 @@ } | ||
payload: localSDP, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -129,2 +129,3 @@ } | ||
clientId, | ||
userId, | ||
timestamp: Date.now(), | ||
@@ -145,2 +146,3 @@ payload: extensionStats.payload, | ||
clientId, | ||
userId, | ||
timestamp: Date.now(), | ||
@@ -157,3 +159,3 @@ ...callEvent, | ||
payload: userMediaError, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -168,3 +170,3 @@ } | ||
payload: certificate, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -179,3 +181,3 @@ } | ||
payload: codec, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -190,3 +192,3 @@ } | ||
payload: iceServer, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -201,3 +203,3 @@ } | ||
payload: mediaDevice, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -212,3 +214,3 @@ } | ||
payload: mediaSource, | ||
}); | ||
}, userId); | ||
reports.addCallMetaReport(callMetaReport); | ||
@@ -215,0 +217,0 @@ } |
@@ -13,5 +13,8 @@ import * as Models from '../../models/Models'; | ||
reports: ReportsCollector, | ||
fetchSamples: boolean | ||
fetchSamples: boolean, | ||
remoteTrackId?: string, | ||
remotePeerConnectionId?: string, | ||
remoteClientId?: string, | ||
) { | ||
const { trackId } = observedInboundAudioTrack; | ||
const { trackId, sfuStreamId, sfuSinkId } = observedInboundAudioTrack; | ||
@@ -29,3 +32,3 @@ const { peerConnectionId } = observedInboundAudioTrack.peerConnection; | ||
const { serviceId, roomId, callId } = observedInboundAudioTrack.peerConnection.client.call; | ||
let storedInboundAudioTrack = storedInboundTracks.get(trackId); | ||
@@ -38,6 +41,9 @@ if (!storedInboundAudioTrack) { | ||
clientId, | ||
kind: 'audio', | ||
peerConnectionId, | ||
mediaUnitId, | ||
trackId, | ||
sfuSinkId, | ||
sfuStreamId, | ||
userId, | ||
@@ -64,2 +70,3 @@ marker, | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -70,2 +77,5 @@ peerConnectionId, | ||
sampleSeq: -1, | ||
remoteClientId, | ||
remotePeerConnectionId, | ||
remoteTrackId, | ||
}; | ||
@@ -101,4 +111,4 @@ reports.addInboundAudioTrackReport(report); | ||
} | ||
storedInboundAudioTrack.ssrc = [...statsMap.keys()]; | ||
storedInboundAudioTrack.videoStats = Array.from(statsMap.values()); | ||
} |
@@ -15,5 +15,8 @@ import { InboundVideoTrackReport } from '@observertc/report-schemas-js'; | ||
reports: ReportsCollector, | ||
fetchSamples: boolean | ||
fetchSamples: boolean, | ||
remoteTrackId?: string, | ||
remotePeerConnectionId?: string, | ||
remoteClientId?: string, | ||
) { | ||
const { trackId } = observedInboundVideoTrack; | ||
const { trackId, sfuStreamId, sfuSinkId } = observedInboundVideoTrack; | ||
@@ -39,5 +42,9 @@ const { peerConnectionId } = observedInboundVideoTrack.peerConnection; | ||
clientId, | ||
kind: 'video', | ||
peerConnectionId, | ||
mediaUnitId, | ||
trackId, | ||
sfuStreamId, | ||
sfuSinkId, | ||
@@ -64,2 +71,3 @@ userId, | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -70,2 +78,5 @@ peerConnectionId, | ||
sampleSeq: -1, | ||
remoteClientId, | ||
remotePeerConnectionId, | ||
remoteTrackId, | ||
}; | ||
@@ -103,3 +114,4 @@ reports.addInboundVideoTrackReport(report); | ||
} | ||
storedInboundVideoTrack.ssrc = [...statsMap.keys()]; | ||
storedInboundVideoTrack.videoStats = Array.from(statsMap.values()); | ||
} |
@@ -15,3 +15,3 @@ import * as Models from '../../models/Models'; | ||
) { | ||
const { trackId } = observedOutboundAudioTrack; | ||
const { trackId, sfuStreamId } = observedOutboundAudioTrack; | ||
@@ -37,6 +37,8 @@ const { peerConnectionId } = observedOutboundAudioTrack.peerConnection; | ||
clientId, | ||
kind: 'audio', | ||
peerConnectionId, | ||
mediaUnitId, | ||
trackId, | ||
sfuStreamId, | ||
userId, | ||
@@ -62,2 +64,3 @@ marker, | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -94,3 +97,4 @@ peerConnectionId, | ||
} | ||
storedOutboundAudioTrack.ssrc = [...statsMap.keys()]; | ||
storedOutboundAudioTrack.audioStats = Array.from(statsMap.values()); | ||
} |
@@ -15,3 +15,3 @@ import * as Models from '../../models/Models'; | ||
) { | ||
const { trackId } = observedOutboundVideoTrack; | ||
const { trackId, sfuStreamId } = observedOutboundVideoTrack; | ||
@@ -37,2 +37,3 @@ const { peerConnectionId } = observedOutboundVideoTrack.peerConnection; | ||
clientId, | ||
kind: 'video', | ||
peerConnectionId, | ||
@@ -42,2 +43,3 @@ mediaUnitId, | ||
sfuStreamId, | ||
userId, | ||
@@ -63,2 +65,3 @@ marker, | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -97,3 +100,4 @@ peerConnectionId, | ||
} | ||
storedOutboundVideoTrack.ssrc = [...statsMap.keys()]; | ||
storedOutboundVideoTrack.videoStats = Array.from(statsMap.values()); | ||
} |
@@ -5,3 +5,3 @@ import { ObservedPeerConnection } from '../../samples/ObservedPeerConnection'; | ||
import { logger } from '../VisitObservedCallsMiddleware'; | ||
import { PeerConnectionTransportReport } from '@observertc/report-schemas-js'; | ||
import { IceCandidatePairReport, PeerConnectionTransportReport } from '@observertc/report-schemas-js'; | ||
import { Samples_ClientSample_IceCandidatePair, Samples_ClientSample_IceLocalCandidate, Samples_ClientSample_IceRemoteCandidate, Samples_ClientSample_PeerConnectionTransport } from '../../models/samples_pb'; | ||
@@ -51,2 +51,3 @@ | ||
clientId, | ||
userId, | ||
mediaUnitId, | ||
@@ -60,2 +61,17 @@ ...pcTransport, | ||
for (const iceCandidatePair of observedPeerConnection.iceCandidatePairs()) { | ||
const report: IceCandidatePairReport = { | ||
serviceId, | ||
roomId, | ||
callId, | ||
userId, | ||
clientId, | ||
mediaUnitId, | ||
...iceCandidatePair, | ||
timestamp, | ||
sampleSeq: -1, // deprecated | ||
}; | ||
reports.addIceCandidatePairReport(report); | ||
} | ||
if (fetchSamples) { | ||
@@ -62,0 +78,0 @@ storedPeerConnection.icelocalCandidates = []; |
@@ -276,2 +276,7 @@ // @generated by protoc-gen-es v1.1.1 with parameter "target=ts" | ||
/** | ||
* @generated from field: optional uint64 touched = 17; | ||
*/ | ||
touched?: bigint; | ||
constructor(data?: PartialMessage<PeerConnection>) { | ||
@@ -301,2 +306,3 @@ super(); | ||
{ no: 16, name: "transports", kind: "message", T: Samples_ClientSample_PeerConnectionTransport, repeated: true }, | ||
{ no: 17, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -391,11 +397,21 @@ | ||
/** | ||
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundAudioTrack audioStats = 14; | ||
* @generated from field: repeated int64 ssrc = 14; | ||
*/ | ||
ssrc: bigint[] = []; | ||
/** | ||
* @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 = 15; | ||
* @generated from field: repeated org.observertc.schemas.protobuf.Samples.ClientSample.InboundVideoTrack videoStats = 16; | ||
*/ | ||
videoStats: Samples_ClientSample_InboundVideoTrack[] = []; | ||
/** | ||
* @generated from field: optional uint64 touched = 17; | ||
*/ | ||
touched?: bigint; | ||
constructor(data?: PartialMessage<InboundTrack>) { | ||
@@ -422,4 +438,6 @@ super(); | ||
{ no: 13, name: "sfuStreamId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 14, name: "audioStats", kind: "message", T: Samples_ClientSample_InboundAudioTrack, repeated: true }, | ||
{ no: 15, name: "videoStats", kind: "message", T: Samples_ClientSample_InboundVideoTrack, repeated: true }, | ||
{ 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 }, | ||
]); | ||
@@ -523,2 +541,7 @@ | ||
/** | ||
* @generated from field: optional uint64 touched = 16; | ||
*/ | ||
touched?: bigint; | ||
constructor(data?: PartialMessage<OutboundTrack>) { | ||
@@ -547,2 +570,3 @@ super(); | ||
{ no: 15, name: "videoStats", kind: "message", T: Samples_ClientSample_OutboundVideoTrack, repeated: true }, | ||
{ no: 16, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -712,5 +736,5 @@ | ||
/** | ||
* @generated from field: optional uint64 serverTouched = 12; | ||
* @generated from field: optional uint64 touched = 12; | ||
*/ | ||
serverTouched?: bigint; | ||
touched?: bigint; | ||
@@ -736,3 +760,3 @@ constructor(data?: PartialMessage<SfuTransport>) { | ||
{ no: 11, name: "sctpChannelIds", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, | ||
{ no: 12, name: "serverTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 12, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -802,5 +826,5 @@ | ||
/** | ||
* @generated from field: optional uint64 sampleTouched = 9; | ||
* @generated from field: optional uint64 touched = 9; | ||
*/ | ||
sampleTouched?: bigint; | ||
touched?: bigint; | ||
@@ -817,7 +841,2 @@ /** | ||
/** | ||
* @generated from field: optional uint64 serverTouched = 12; | ||
*/ | ||
serverTouched?: bigint; | ||
constructor(data?: PartialMessage<SfuInboundRtpPad>) { | ||
@@ -839,6 +858,5 @@ super(); | ||
{ no: 8, name: "added", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
{ no: 9, name: "sampleTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 9, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 10, name: "mediaUnitId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 11, name: "marker", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 12, name: "serverTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -913,5 +931,5 @@ | ||
/** | ||
* @generated from field: optional uint64 sampleTouched = 10; | ||
* @generated from field: optional uint64 touched = 10; | ||
*/ | ||
sampleTouched?: bigint; | ||
touched?: bigint; | ||
@@ -928,7 +946,2 @@ /** | ||
/** | ||
* @generated from field: optional uint64 serverTouched = 13; | ||
*/ | ||
serverTouched?: bigint; | ||
constructor(data?: PartialMessage<SfuOutboundRtpPad>) { | ||
@@ -951,6 +964,5 @@ super(); | ||
{ no: 9, name: "added", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
{ no: 10, name: "sampleTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 10, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 11, name: "mediaUnitId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 12, name: "marker", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 13, name: "serverTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -1010,5 +1022,5 @@ | ||
/** | ||
* @generated from field: optional uint64 sampleTouched = 7; | ||
* @generated from field: optional uint64 touched = 7; | ||
*/ | ||
sampleTouched?: bigint; | ||
touched?: bigint; | ||
@@ -1025,7 +1037,2 @@ /** | ||
/** | ||
* @generated from field: optional uint64 serverTouched = 10; | ||
*/ | ||
serverTouched?: bigint; | ||
constructor(data?: PartialMessage<SfuSctpChannel>) { | ||
@@ -1045,6 +1052,5 @@ super(); | ||
{ no: 6, name: "opened", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
{ no: 7, name: "sampleTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 7, name: "touched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
{ no: 8, name: "mediaUnitId", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 9, name: "marker", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 10, name: "serverTouched", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, | ||
]); | ||
@@ -1051,0 +1057,0 @@ |
@@ -56,2 +56,3 @@ import { ObserverReportsEmitter, ObserverSinkProcess, SinkConfig, SinkImpl } from './sinks/ObserverSink'; | ||
fetchSamples: true, | ||
maxIdleTimeInMs: 300 * 1000, | ||
}, | ||
@@ -58,0 +59,0 @@ sink: {}, |
@@ -0,1 +1,2 @@ | ||
import { iteratorConverter } from '../common/utils'; | ||
import { ObservedCall, ObservedCallBuilder } from './ObservedCall'; | ||
@@ -38,3 +39,3 @@ | ||
const callIds = function* (): IterableIterator<string> { | ||
const callIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -44,4 +45,5 @@ yield observedCall.callId; | ||
}; | ||
const callIds = () => iteratorConverter<string>(callIdsGenerator()); | ||
const clientIds = function* (): IterableIterator<string> { | ||
const clientIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -53,4 +55,5 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const clientIds = () => iteratorConverter<string>(clientIdsGenerator()); | ||
const peerConnectionIds = function* (): IterableIterator<string> { | ||
const peerConnectionIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -64,4 +67,5 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const peerConnectionIds = () => iteratorConverter<string>(peerConnectionIdsGenerator()); | ||
const inboundAudioTrackIds = function* (): IterableIterator<string> { | ||
const inboundAudioTrackIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -77,4 +81,5 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const inboundAudioTrackIds = () => iteratorConverter<string>(inboundAudioTrackIdsGenerator()); | ||
const inboundVideoTrackIds = function* (): IterableIterator<string> { | ||
const inboundVideoTrackIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -90,4 +95,5 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const inboundVideoTrackIds = () => iteratorConverter<string>(inboundVideoTrackIdsGenerator()); | ||
const outboundAudioTrackIds = function* (): IterableIterator<string> { | ||
const outboundAudioTrackIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -103,4 +109,5 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const outboundAudioTrackIds = () => iteratorConverter<string>(outboundAudioTrackIdsGenerator()); | ||
const outboundVideoTrackIds = function* (): IterableIterator<string> { | ||
const outboundVideoTrackIdsGenerator = function* () { | ||
for (const observedCall of observedCalls.values()) { | ||
@@ -116,2 +123,3 @@ for (const observedClient of observedCall.observedClients()) { | ||
}; | ||
const outboundVideoTrackIds = () => iteratorConverter<string>(outboundVideoTrackIdsGenerator()); | ||
@@ -133,4 +141,6 @@ const result: ObservedCalls = { | ||
} | ||
this._builders.clear(); | ||
return result; | ||
} | ||
} |
@@ -7,2 +7,4 @@ import { InboundAudioTrack } from '@observertc/sample-schemas-js'; | ||
readonly trackId: string; | ||
readonly sfuStreamId?: string, | ||
readonly sfuSinkId?: string, | ||
@@ -9,0 +11,0 @@ samples(): IterableIterator<InboundAudioTrack>; |
@@ -7,3 +7,5 @@ import { InboundVideoTrack } from '@observertc/sample-schemas-js'; | ||
readonly trackId: string; | ||
readonly sfuStreamId?: string, | ||
readonly sfuSinkId?: string, | ||
samples(): IterableIterator<InboundVideoTrack>; | ||
@@ -10,0 +12,0 @@ } |
@@ -7,3 +7,4 @@ import { OutboundAudioTrack } from '@observertc/sample-schemas-js'; | ||
readonly trackId: string; | ||
readonly sfuStreamId?: string, | ||
samples(): IterableIterator<OutboundAudioTrack>; | ||
@@ -10,0 +11,0 @@ } |
@@ -7,3 +7,4 @@ import { OutboundVideoTrack } from '@observertc/sample-schemas-js'; | ||
readonly trackId: string; | ||
readonly sfuStreamId?: string, | ||
samples(): IterableIterator<OutboundVideoTrack>; | ||
@@ -10,0 +11,0 @@ } |
@@ -69,3 +69,7 @@ import { | ||
if (inboundAudioTrackSample.trackId) { | ||
const builder = this._getInboundAudioTrackBuilder(inboundAudioTrackSample.trackId); | ||
const builder = this._getInboundAudioTrackBuilder( | ||
inboundAudioTrackSample.trackId, | ||
inboundAudioTrackSample.sfuStreamId, | ||
inboundAudioTrackSample.sfuSinkId | ||
); | ||
builder.addSample(inboundAudioTrackSample); | ||
@@ -85,3 +89,3 @@ } | ||
private _getInboundAudioTrackBuilder(trackId: string): ObservedInboundAudioTrackBuilder { | ||
private _getInboundAudioTrackBuilder(trackId: string, sfuStreamId?: string, sfuSinkId?: string): ObservedInboundAudioTrackBuilder { | ||
let result = this._inboundAudioTracks.get(trackId); | ||
@@ -91,2 +95,4 @@ if (!result) { | ||
trackId, | ||
sfuStreamId, | ||
sfuSinkId, | ||
}); | ||
@@ -100,3 +106,6 @@ this._inboundAudioTracks.set(trackId, result); | ||
if (outboundAudioTrackSample.trackId) { | ||
const builder = this._getOutboundAudioTrackBuilder(outboundAudioTrackSample.trackId); | ||
const builder = this._getOutboundAudioTrackBuilder( | ||
outboundAudioTrackSample.trackId, | ||
outboundAudioTrackSample.sfuStreamId, | ||
); | ||
builder.addSample(outboundAudioTrackSample); | ||
@@ -106,3 +115,3 @@ } | ||
private _getOutboundAudioTrackBuilder(trackId: string): ObservedOutboundAudioTrackBuilder { | ||
private _getOutboundAudioTrackBuilder(trackId: string, sfuStreamId?: string): ObservedOutboundAudioTrackBuilder { | ||
let result = this._outboundAudioTracks.get(trackId); | ||
@@ -112,2 +121,3 @@ if (!result) { | ||
trackId, | ||
sfuStreamId | ||
}); | ||
@@ -121,3 +131,7 @@ this._outboundAudioTracks.set(trackId, result); | ||
if (inboundVideoTrackSample.trackId) { | ||
const builder = this._getInboundVideoTrackBuilder(inboundVideoTrackSample.trackId); | ||
const builder = this._getInboundVideoTrackBuilder( | ||
inboundVideoTrackSample.trackId, | ||
inboundVideoTrackSample.sfuStreamId, | ||
inboundVideoTrackSample.sfuSinkId, | ||
); | ||
builder.addSample(inboundVideoTrackSample); | ||
@@ -127,3 +141,3 @@ } | ||
private _getInboundVideoTrackBuilder(trackId: string): ObservedInboundVideoTrackBuilder { | ||
private _getInboundVideoTrackBuilder(trackId: string, sfuStreamId?: string, sfuSinkId?: string): ObservedInboundVideoTrackBuilder { | ||
let result = this._inboundVideoTracks.get(trackId); | ||
@@ -133,2 +147,4 @@ if (!result) { | ||
trackId, | ||
sfuStreamId, | ||
sfuSinkId, | ||
}); | ||
@@ -142,3 +158,6 @@ this._inboundVideoTracks.set(trackId, result); | ||
if (outboundVideoTrackSample.trackId) { | ||
const builder = this._getOutboundVideoTrackBuilder(outboundVideoTrackSample.trackId); | ||
const builder = this._getOutboundVideoTrackBuilder( | ||
outboundVideoTrackSample.trackId, | ||
outboundVideoTrackSample.sfuStreamId, | ||
); | ||
builder.addSample(outboundVideoTrackSample); | ||
@@ -148,3 +167,3 @@ } | ||
private _getOutboundVideoTrackBuilder(trackId: string): ObservedOutboundVideoTrackBuilder { | ||
private _getOutboundVideoTrackBuilder(trackId: string, sfuStreamId?: string): ObservedOutboundVideoTrackBuilder { | ||
let result = this._outboundVideoTracks.get(trackId); | ||
@@ -154,2 +173,3 @@ if (!result) { | ||
trackId, | ||
sfuStreamId, | ||
}); | ||
@@ -156,0 +176,0 @@ this._outboundVideoTracks.set(trackId, result); |
@@ -0,1 +1,2 @@ | ||
import { iteratorConverter } from '../common/utils'; | ||
import { ObservedCall, ObservedCallBuilder } from './ObservedCall'; | ||
@@ -36,3 +37,3 @@ import { ObservedSfu, ObservedSfuBuilder } from './ObservedSfu'; | ||
const sfuIds = function* (): IterableIterator<string> { | ||
const sfuIdsGenerator = function* () { | ||
for (const observedSfu of observedSfus.values()) { | ||
@@ -42,4 +43,5 @@ yield observedSfu.sfuId; | ||
}; | ||
const sfuIds = () => iteratorConverter<string>(sfuIdsGenerator()); | ||
const sfuTransportIds = function* (): IterableIterator<string> { | ||
const sfuTransportIdsGenerator = function* () { | ||
for (const observedSfu of observedSfus.values()) { | ||
@@ -51,4 +53,5 @@ for (const observedTransport of observedSfu.observedSfuTransports()) { | ||
}; | ||
const sfuTransportIds = () => iteratorConverter<string>(sfuTransportIdsGenerator()); | ||
const sfuInboundRtpPadIds = function* (): IterableIterator<string> { | ||
const sfuInboundRtpPadIdsGenerator = function* () { | ||
for (const observedSfu of observedSfus.values()) { | ||
@@ -62,4 +65,5 @@ for (const observedTransport of observedSfu.observedSfuTransports()) { | ||
}; | ||
const sfuInboundRtpPadIds = () => iteratorConverter<string>(sfuInboundRtpPadIdsGenerator()); | ||
const sfuOutboundRtpPadIds = function* (): IterableIterator<string> { | ||
const sfuOutboundRtpPadIdsGenerator = function* () { | ||
for (const observedSfu of observedSfus.values()) { | ||
@@ -73,4 +77,4 @@ for (const observedTransport of observedSfu.observedSfuTransports()) { | ||
}; | ||
const sfuOutboundRtpPadIds = () => iteratorConverter<string>(sfuOutboundRtpPadIdsGenerator()); | ||
const result: ObservedSfus = { | ||
@@ -88,4 +92,5 @@ sfuIds, | ||
} | ||
this._builders.clear(); | ||
return result; | ||
} | ||
} |
@@ -93,2 +93,7 @@ /** | ||
[Symbol.asyncIterator](): AsyncIterableIterator<[K, V]>; | ||
/** | ||
* Returns an iterable iterator for the key-value pairs stored in this local instance of the storage. | ||
*/ | ||
localEntries(): IterableIterator<[K, V]>; | ||
} |
@@ -93,2 +93,6 @@ import { ObserverStorage } from './ObserverStorage'; | ||
} | ||
public localEntries(): IterableIterator<[K, V]> { | ||
return this._map.entries(); | ||
} | ||
} |
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 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 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 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 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 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 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 not supported yet
Sorry, the diff of this file is not supported yet
1007932
257
20351