Skip to content

Commit 25c4d15

Browse files
authored
fix: double check history length after filter (#34)
1 parent 9cf4ce7 commit 25c4d15

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/detectors/VideoDecoderIssueDetector.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ interface VideoDecoderIssueDetectorParams extends BaseIssueDetectorParams {
1515
minMosQuality?: number;
1616
}
1717

18+
const MIN_STATS_HISTORY_LENGTH = 5;
19+
1820
class VideoDecoderIssueDetector extends BaseIssueDetector {
1921
readonly #volatilityThreshold: number;
2022

@@ -58,7 +60,7 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
5860
const throtthedStreams = data.video.inbound
5961
.map((incomeVideoStream): { ssrc: number, allFps: number[], volatility: number } | undefined => {
6062
// At least 5 elements needed to have enough representation
61-
if (allProcessedStats.length < 5) {
63+
if (allProcessedStats.length < MIN_STATS_HISTORY_LENGTH) {
6264
return undefined;
6365
}
6466

@@ -78,7 +80,7 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
7880
}
7981
}
8082

81-
if (allFps.length === 0) {
83+
if (allFps.length < MIN_STATS_HISTORY_LENGTH) {
8284
return undefined;
8385
}
8486

0 commit comments

Comments
 (0)