import IDisposable from '../lang/IDisposable'; import Subject from '../rx/Subject'; import IPeerConnection from './IPeerConnection'; import ReadOnlySubject from '../rx/ReadOnlySubject'; export interface IRtcMonitorStatistic { [kind: string]: IRtcStatistic; } export interface ILegacyRTCStatsReport { result: () => ILegacyRTCStatsReportItem[]; } export interface ILegacyRTCStatsReportItem extends RTCStatsReport { type: string; names: () => string[]; stat: (name: string) => number; } export interface IRtcStatistic { ssrc?: string; mediaType?: string; timestamp: number; bitrate?: number; bytesReceived?: number; framesDecoded?: number; packetsLost?: number; packetsReceived?: number; codec?: string; fps?: number; roundTripTime?: number; lastPacketReceivedTimestamp?: number; } export default class RtcConnectionMonitor implements IDisposable { private readonly _logger; private readonly _estimatedRoundTripTime; private readonly _estimatedVideoCodec; private readonly _estimatedAudioCodec; private readonly _rtcStatistic; private readonly _disposables; private _peerConnection; private _isMonitorRunning; private _updateTimeout; private _tracksToMonitor; private _monitorGeneration; constructor(peerConnection: IPeerConnection, mediaStream: MediaStream, estimatedRoundTripTime: number, isForeground: ReadOnlySubject); get rtcStatistic(): Subject; dispose(): void; private updateStatistic; private updateStatisticLegacy; private getCodecByType; }