Skip to content

Commit c3bced8

Browse files
committed
chore: show codec and clock rate
1 parent 3a09fcc commit c3bced8

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

ui/src/components/sidebar/connectionStats.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export default function ConnectionStatsSidebar() {
1919
appendLocalCandidateStats,
2020
appendRemoteCandidateStats,
2121
appendDiskDataChannelStats,
22+
setCodecInfo,
23+
codecInfo,
2224
} = useRTCStore();
2325

2426
useInterval(function collectWebRTCStats() {
@@ -52,6 +54,8 @@ export default function ConnectionStatsSidebar() {
5254
}
5355
} else if (report.type === "data-channel" && report.label === "disk") {
5456
appendDiskDataChannelStats(report);
57+
} else if (report.type === "codec") {
58+
setCodecInfo(report);
5559
}
5660
});
5761
})();
@@ -124,7 +128,18 @@ export default function ConnectionStatsSidebar() {
124128
<div className="space-y-3">
125129
<SettingsSectionHeader
126130
title="Video"
127-
description="The video stream from the JetKVM to the client."
131+
description={<>
132+
The video stream from the JetKVM to the client.
133+
{codecInfo && <div className="text-xs text-slate-700 dark:text-slate-300 mt-1 flex flex-col">
134+
<div>
135+
Current codec: <strong>{codecInfo.mimeType}</strong>
136+
</div>
137+
<div>
138+
Clock Rate: <strong>{codecInfo.clockRate}</strong>
139+
</div>
140+
</div>}
141+
</>
142+
}
128143
/>
129144

130145
{/* RTP Jitter */}

ui/src/hooks/stores.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ export interface RTCState {
131131
appendInboundRtpStats: (stats: RTCInboundRtpStreamStats) => void;
132132
clearInboundRtpStats: () => void;
133133

134+
codecInfo: RTCRtpCodec | null;
135+
setCodecInfo: (info: RTCRtpCodec) => void;
136+
134137
candidatePairStats: Map<number, RTCIceCandidatePairStats>;
135138
appendCandidatePairStats: (stats: RTCIceCandidatePairStats) => void;
136139
clearCandidatePairStats: () => void;
@@ -179,6 +182,9 @@ export const useRTCStore = create<RTCState>(set => ({
179182
isTurnServerInUse: false,
180183
setTurnServerInUse: (inUse: boolean) => set({ isTurnServerInUse: inUse }),
181184

185+
codecInfo: null,
186+
setCodecInfo: (info: RTCRtpCodec) => set({ codecInfo: info }),
187+
182188
inboundRtpStats: new Map(),
183189
appendInboundRtpStats: (stats: RTCInboundRtpStreamStats) => {
184190
set(prevState => ({

0 commit comments

Comments
 (0)