@observertc/client-monitor-js
Version:
ObserveRTC Client Integration Javascript Library
1 lines • 1.46 kB
JavaScript
export class RemoteInboundRtpMonitor{_peerConnection;_visited=!0;timestamp;id;ssrc;kind;transportId;codecId;packetsReceived;packetsLost;jitter;localId;roundTripTime;totalRoundTripTime;fractionLost;roundTripTimeMeasurements;packetRate;deltaPacketsLost;attachments;appData;constructor(t,e){this._peerConnection=t,this.id=e.id,this.timestamp=e.timestamp,this.ssrc=e.ssrc,this.kind=e.kind,Object.assign(this,e)}get visited(){const t=this._visited;return this._visited=!1,t}getPeerConnection(){return this._peerConnection}getOutboundRtp(){return this._peerConnection.mappedOutboundRtpMonitors.get(this.ssrc)}getCodec(){return this._peerConnection.mappedCodecMonitors.get(this.codecId??"")}accept(t){this._visited=!0;const e=t.timestamp-this.timestamp;if(e<=0)return;const s=e/1e3;void 0!==this.packetsReceived&&void 0!==t.packetsReceived&&(this.packetRate=(t.packetsReceived-this.packetsReceived)/s),void 0!==this.packetsLost&&void 0!==t.packetsLost&&(this.deltaPacketsLost=t.packetsLost-this.packetsLost),Object.assign(this,t)}createSample(){return{timestamp:this.timestamp,id:this.id,ssrc:this.ssrc,kind:this.kind,transportId:this.transportId,codecId:this.codecId,packetsReceived:this.packetsReceived,packetsLost:this.packetsLost,jitter:this.jitter,localId:this.localId,roundTripTime:this.roundTripTime,totalRoundTripTime:this.totalRoundTripTime,fractionLost:this.fractionLost,roundTripTimeMeasurements:this.roundTripTimeMeasurements,attachments:this.attachments}}}