Skip to content

Commit abf7b57

Browse files
committed
fix: debug
1 parent 74c5243 commit abf7b57

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/detectors/VideoDecoderIssueDetector.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
5252

5353
const throtthedStreams = data.video.inbound
5454
.map((incomeVideoStream): { ssrc: number, allFps: number[], volatility: number } | undefined => {
55-
const allFps: number[] = [];
56-
5755
const isSpatialLayerChanged = isSvcSpatialLayerChanged(incomeVideoStream.ssrc, allProcessedStats);
5856
if (isSpatialLayerChanged) {
5957
return undefined;
@@ -64,6 +62,19 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
6462
return undefined;
6563
}
6664

65+
const allFps: number[] = [];
66+
67+
// exclude first element to calculate accurate delta
68+
for (let i = 1; i < allProcessedStats.length; i += 1) {
69+
const videoStreamStats = allProcessedStats[i].video.inbound.find(
70+
(stream) => stream.ssrc === incomeVideoStream.ssrc,
71+
);
72+
73+
if (videoStreamStats) {
74+
allFps.push(videoStreamStats.framesPerSecond);
75+
}
76+
}
77+
6778
// Calculate volatility fps
6879
const meanFps = allFps.reduce((acc, val) => acc + val, 0) / allFps.length;
6980
const meanAbsoluteDeviationFps = allFps
@@ -85,6 +96,7 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
8596
.filter((throttledVideoStream) => Boolean(throttledVideoStream));
8697

8798
const affectedStreamsPercent = throtthedStreams.length / (data.video.inbound.length / 100);
99+
console.log('THROTTLE AFFECTION', { affectedStreamsPercent });
88100
if (affectedStreamsPercent > this.#affectedStreamsPercentThreshold) {
89101
console.log('THROTTLE DETECTED !!!!');
90102
issues.push({

0 commit comments

Comments
 (0)