Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add jitter to pre call diagnostics report #3386

Merged
merged 16 commits into from
Dec 2, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export class DiagnosticsStatsCollector {
const ridAveragedVideoBitrateList = this.localVideoTrackStatsList.map(trackStatsMap =>
trackStatsMap ? calculateAverage(Object.values(trackStatsMap), curr => curr.bitrate) : 0,
);

const audioJitter = getLastElement(this.remoteAudioTrackStatsList)?.jitter || 0;
const videoJitter = getLastElement(this.remoteVideoTrackStatsList)?.jitter || 0;
const jitter = Math.max(audioJitter, videoJitter);
KaustubhKumar05 marked this conversation as resolved.
Show resolved Hide resolved
const lastLocalAudioTrackStats = getLastElement(this.localAudioTrackStatsList);
const lastLocalVideoTrackStats = getLastElement(this.localVideoTrackStatsList);

Expand All @@ -80,6 +82,7 @@ export class DiagnosticsStatsCollector {
bytesReceived: lastSubscribeStats?.bytesReceived || 0,
bitrateSent: calculateAverage(this.peerStatsList, curr => curr.publish?.bitrate),
bitrateReceived: calculateAverage(this.peerStatsList, curr => curr.subscribe?.bitrate),
jitter: jitter,
},
audio: {
roundTripTime,
Expand All @@ -91,6 +94,7 @@ export class DiagnosticsStatsCollector {
bytesSent: lastLocalAudioTrackStats
? Object.values(lastLocalAudioTrackStats).reduce((acc, curr) => acc + (curr.bytesSent || 0), 0)
: 0,
jitter: audioJitter,
},
video: {
roundTripTime,
Expand All @@ -102,6 +106,7 @@ export class DiagnosticsStatsCollector {
bytesSent: lastLocalVideoTrackStats
? Object.values(lastLocalVideoTrackStats).reduce((acc, curr) => acc + (curr.bytesSent || 0), 0)
: 0,
jitter: videoJitter,
},
};
}
Expand Down
1 change: 1 addition & 0 deletions packages/hms-video-store/src/diagnostics/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ export interface DiagnosticsRTCStats {
bitrateSent: number;
bitrateReceived: number;
roundTripTime: number;
jitter: number;
}
2 changes: 2 additions & 0 deletions packages/roomkit-react/src/Diagnostics/ConnectivityTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const AudioStats = ({ stats }: { stats: DiagnosticsRTCStats | undefined }) => {
<DetailedInfo title="Bitrate Sent" value={formatBytes(stats.bitrateSent, 'b/s')} />
<DetailedInfo title="Bitrate Received" value={formatBytes(stats.bitrateReceived, 'b/s')} />
<DetailedInfo title="Round Trip Time" value={`${stats.roundTripTime} ms`} />
<DetailedInfo title="Jitter" value={`${stats.jitter * 1000} ms`} />
KaustubhKumar05 marked this conversation as resolved.
Show resolved Hide resolved
</Flex>
)}
</ConnectivityTestStepResult>
Expand All @@ -182,6 +183,7 @@ const VideoStats = ({ stats }: { stats: DiagnosticsRTCStats | undefined }) => {
<DetailedInfo title="Bitrate Sent" value={formatBytes(stats.bitrateSent, 'b/s')} />
<DetailedInfo title="Bitrate Received" value={formatBytes(stats.bitrateReceived, 'b/s')} />
<DetailedInfo title="Round Trip Time" value={`${stats.roundTripTime} ms`} />
<DetailedInfo title="Jitter" value={`${stats.jitter * 1000} ms`} />
</Flex>
)}
</ConnectivityTestStepResult>
Expand Down