Skip to content

Commit

Permalink
add client-monitor properties
Browse files Browse the repository at this point in the history
  • Loading branch information
balazskreith committed Nov 21, 2024
1 parent 4543249 commit a128c21
Show file tree
Hide file tree
Showing 30 changed files with 70 additions and 2,349 deletions.
110 changes: 61 additions & 49 deletions webapp/src/actions/client-monitor-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,28 @@ import { createSignal } from 'solid-js';
import { AudioPlayoutEntry, LocalCandidateEntry, ReceiverEntry, RemoteCandidateEntry } from '@observertc/client-monitor-js/lib/entries/StatsEntryInterfaces';

// eslint-disable-next-line no-unused-vars
function getResultOrEmpty<T>(accessor: (i: T) => ShowObjectAccessor, value?: T): ShowObjectAccessor {
if (value) return accessor(value);
// function getResultOrEmpty<T>(accessor: (i: T) => ShowObjectAccessor, value?: T): ShowObjectAccessor {
// if (value) return accessor(value);

const [result] = createSignal<ShowObjectProperties>({});
// const [result] = createSignal<ShowObjectProperties>({});

return () => ({
properties: result,
cleanup: () => {}
});
// return () => ({
// properties: result,
// cleanup: () => {}
// });
// }

function getResultOrEmpty<T>(accessor: (i: T) => ShowObjectAccessor, value?: T): ShowObjectAccessor {
return () => {
if (value) return accessor(value)();

const [result] = createSignal<ShowObjectProperties>({});

return {
properties: result,
cleanup: () => {}
};
};
}

function getPrimitiveProps(value: number | undefined | null | string): ShowObjectAccessor {
Expand Down Expand Up @@ -102,26 +115,25 @@ export function createClientMonitorProps(monitor: ClientMonitor): ShowObjectProp
sendingFractionLost: monitor.sendingFractionLost,
receivingFractionLost: monitor.receivingFractionLost,

// func: () => createPeerConnectionProps(monitor.peerConnections[0]),

peerConnections: createPeerConnectionArrayProps(monitor.peerConnections),
codecs: createCodecArrayProps(monitor.codecs),
inboundRtps: createInboundRtpArrayProps(monitor.inboundRtps),
outboundRtps: createOutboundRtpArrayProps(monitor.outboundRtps),
// remoteInboundRtps: createRemoteInboundRtpArrayProps(monitor.remoteInboundRtps),
// remoteOutboundRtps: createRemoteOutboundRtpArrayProps(monitor.remoteOutboundRtps),
// mediaSources: createMediaSourceArrayProps(monitor.mediaSources),
// dataChannels: createDataChannelArrayProps(monitor.dataChannels),
// transports: createTransportArrayProps(monitor.transports),
// iceCandidatePairs: createIceCandidatePairArrayProps(monitor.iceCandidatePairs),
// iceLocalCandidates: createIceLocalCandidateArrayProps(monitor.iceLocalCandidates),
// iceRemoteCandidates: createIceRemoteCandidateArrayProps(monitor.iceRemoteCandidates),
// transceivers: createTransceiverArrayProps(monitor.transceivers),
// senders: createSenderArrayProps(monitor.senders),
// sctpTransports: createSctpTransportsArratProps(monitor.sctpTransports),
// certificates: createCertificateArrayProps(monitor.certificates),
// iceServers: createIceServerArrayProps(monitor.iceServers),
// contributingSources: createContributingSourcesArrayProps(monitor.contributingSources),
// receivers: createReceiverArrayProps(monitor.receivers),
remoteInboundRtps: createRemoteInboundRtpArrayProps(monitor.remoteInboundRtps),
remoteOutboundRtps: createRemoteOutboundRtpArrayProps(monitor.remoteOutboundRtps),
mediaSources: createMediaSourceArrayProps(monitor.mediaSources),
dataChannels: createDataChannelArrayProps(monitor.dataChannels),
transports: createTransportArrayProps(monitor.transports),
iceCandidatePairs: createIceCandidatePairArrayProps(monitor.iceCandidatePairs),
iceLocalCandidates: createIceLocalCandidateArrayProps(monitor.iceLocalCandidates),
iceRemoteCandidates: createIceRemoteCandidateArrayProps(monitor.iceRemoteCandidates),
transceivers: createTransceiverArrayProps(monitor.transceivers),
senders: createSenderArrayProps(monitor.senders),
sctpTransports: createSctpTransportsArratProps(monitor.sctpTransports),
certificates: createCertificateArrayProps(monitor.certificates),
iceServers: createIceServerArrayProps(monitor.iceServers),
contributingSources: createContributingSourcesArrayProps(monitor.contributingSources),
receivers: createReceiverArrayProps(monitor.receivers),
// audioPlayouts: createAudioPlayoutArrayProps(monitor.audioPlayouts),

});
Expand Down Expand Up @@ -196,23 +208,23 @@ function createPeerConnectionProps(peerConnection: PeerConnectionEntry): ShowObj
connectionEstablishedDurationInMs: peerConnection.connectionEstablishedDurationInMs,


// 'codecs': createCodecArrayProps([...peerConnection.codecs()]),
// 'inboundRtps()': createInboundRtpArrayProps([...peerConnection.inboundRtps()]),
// 'outboundRtps()': createOutboundRtpArrayProps([...peerConnection.outboundRtps()]),
// 'remoteInboundRtps()': createRemoteInboundRtpArrayProps([...peerConnection.remoteInboundRtps()]),
// 'remoteOutboundRtps()': createRemoteOutboundRtpArrayProps([...peerConnection.remoteOutboundRtps()]),
// 'mediaSources()': createMediaSourceArrayProps([...peerConnection.mediaSources()]),
// 'dataChannels()': createDataChannelArrayProps([...peerConnection.dataChannels()]),
// 'transports()': createTransportArrayProps([...peerConnection.transports()]),
// 'iceCandidatePairs()': createIceCandidatePairArrayProps([...peerConnection.iceCandidatePairs()]),
// 'transceivers()': createTransceiverArrayProps([...peerConnection.transceivers()]),
// 'senders()': createSenderArrayProps([...peerConnection.senders()]),
// 'sctpTransports()': createSctpTransportsArratProps([...peerConnection.sctpTransports()]),
// 'certificates()': createCertificateArrayProps([...peerConnection.certificates()]),
// 'iceServers()': createIceServerArrayProps([...peerConnection.iceServers()]),
// 'contributingSources()': createContributingSourcesArrayProps([...peerConnection.contributingSources()]),
// 'receivers()': createReceiverArrayProps([...peerConnection.receivers()]),
// 'audioPlayouts()': createAudioPlayoutArrayProps([...peerConnection.audioPlayouts()]),
'codecs': createCodecArrayProps([...peerConnection.codecs()]),
'inboundRtps()': createInboundRtpArrayProps([...peerConnection.inboundRtps()]),
'outboundRtps()': createOutboundRtpArrayProps([...peerConnection.outboundRtps()]),
'remoteInboundRtps()': createRemoteInboundRtpArrayProps([...peerConnection.remoteInboundRtps()]),
'remoteOutboundRtps()': createRemoteOutboundRtpArrayProps([...peerConnection.remoteOutboundRtps()]),
'mediaSources()': createMediaSourceArrayProps([...peerConnection.mediaSources()]),
'dataChannels()': createDataChannelArrayProps([...peerConnection.dataChannels()]),
'transports()': createTransportArrayProps([...peerConnection.transports()]),
'iceCandidatePairs()': createIceCandidatePairArrayProps([...peerConnection.iceCandidatePairs()]),
'transceivers()': createTransceiverArrayProps([...peerConnection.transceivers()]),
'senders()': createSenderArrayProps([...peerConnection.senders()]),
'sctpTransports()': createSctpTransportsArratProps([...peerConnection.sctpTransports()]),
'certificates()': createCertificateArrayProps([...peerConnection.certificates()]),
'iceServers()': createIceServerArrayProps([...peerConnection.iceServers()]),
'contributingSources()': createContributingSourcesArrayProps([...peerConnection.contributingSources()]),
'receivers()': createReceiverArrayProps([...peerConnection.receivers()]),
'audioPlayouts()': createAudioPlayoutArrayProps([...peerConnection.audioPlayouts()]),

});

Expand Down Expand Up @@ -333,14 +345,14 @@ function createOutboundRtpProps(outboundRtp: OutboundRtpEntry): ShowObjectAccess
sentBytes: outboundRtp.sentBytes,
sentPackets: outboundRtp.sentPackets,

// getCodec: getResultOrEmpty(createCodecProps, outboundRtp.getCodec()),
// getMediaSource: getResultOrEmpty(createMediaSourceProps, outboundRtp.getMediaSource()),
// getPeerConnection: getResultOrEmpty(createPeerConnectionProps, outboundRtp.getPeerConnection()),
// getRemoteInboundRtp: getResultOrEmpty(createRemoteInboundRtpProps, outboundRtp.getRemoteInboundRtp()),
// getSender: getResultOrEmpty(createSenderProps, outboundRtp.getSender()),
// getSsrc: getResultOrEmpty(getPrimitiveProps, outboundRtp.getSsrc()),
// getTrackId: getResultOrEmpty(getPrimitiveProps, outboundRtp.getTrackId()),
// getTransport: getResultOrEmpty(createTransportProps, outboundRtp.getTransport()),
getCodec: getResultOrEmpty(createCodecProps, outboundRtp.getCodec()),
getMediaSource: getResultOrEmpty(createMediaSourceProps, outboundRtp.getMediaSource()),
getPeerConnection: getResultOrEmpty(createPeerConnectionProps, outboundRtp.getPeerConnection()),
getRemoteInboundRtp: getResultOrEmpty(createRemoteInboundRtpProps, outboundRtp.getRemoteInboundRtp()),
getSender: getResultOrEmpty(createSenderProps, outboundRtp.getSender()),
getSsrc: getResultOrEmpty(getPrimitiveProps, outboundRtp.getSsrc()),
getTrackId: getResultOrEmpty(getPrimitiveProps, outboundRtp.getTrackId()),
getTransport: getResultOrEmpty(createTransportProps, outboundRtp.getTransport()),

stats: outboundRtp.stats
});
Expand Down
44 changes: 0 additions & 44 deletions webapp/src/components/ClientMonitor/AudioPlayoutEntryCmp.tsx

This file was deleted.

42 changes: 0 additions & 42 deletions webapp/src/components/ClientMonitor/CertificateEntryCmp.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion webapp/src/components/ClientMonitor/ClientMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ClientMonitor: Component = () => {
return (
<>
<p class='text-left text-base font-sans text-gray-600 antialiased text-justify'>
An instance of the ClientMonitor class has the following properties: (<b>UNDER DEVELOPMENT</b>)
An instance of the ClientMonitor class has the following properties:
</p>
<ShowObject
{...createClientMonitorProps(m)}
Expand Down
Loading

0 comments on commit a128c21

Please sign in to comment.