Skip to content

Commit c8f1e85

Browse files
committed
fix: added MOS quality threshold as a detector param
1 parent 3c90160 commit c8f1e85

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/detectors/FrozenVideoTrackDetector.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import BaseIssueDetector from './BaseIssueDetector';
1212
interface FrozenVideoTrackDetectorParams {
1313
avgFreezeDurationThresholdMs?: number;
1414
frozenDurationThresholdPct?: number;
15+
minMosQuality?: number;
1516
}
1617

1718
interface FrozenStreamStatsSample {
@@ -25,15 +26,18 @@ class FrozenVideoTrackDetector extends BaseIssueDetector {
2526

2627
readonly #frozenDurationThresholdPct: number;
2728

29+
readonly #minMosQuality: MosQuality;
30+
2831
constructor(params: FrozenVideoTrackDetectorParams = {}) {
2932
super();
3033
this.#avgFreezeDurationThresholdMs = params.avgFreezeDurationThresholdMs ?? 1_000;
3134
this.#frozenDurationThresholdPct = params.frozenDurationThresholdPct ?? 30;
35+
this.#minMosQuality = params.minMosQuality ?? MosQuality.BAD;
3236
}
3337

3438
performDetection(data: WebRTCStatsParsedWithNetworkScores): IssueDetectorResult {
3539
const inboundScore = data.networkScores.inbound;
36-
if (inboundScore !== undefined && inboundScore <= MosQuality.BAD) {
40+
if (inboundScore !== undefined && inboundScore <= this.#minMosQuality) {
3741
// do not execute detection on stats based on poor network quality
3842
// to avoid false positives
3943
return [];

src/detectors/VideoDecoderIssueDetector.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@ import BaseIssueDetector, { BaseIssueDetectorParams } from './BaseIssueDetector'
1212
interface VideoDecoderIssueDetectorParams extends BaseIssueDetectorParams {
1313
volatilityThreshold?: number;
1414
affectedStreamsPercentThreshold?: number;
15+
minMosQuality?: number;
1516
}
1617

1718
class VideoDecoderIssueDetector extends BaseIssueDetector {
1819
readonly #volatilityThreshold: number;
1920

2021
readonly #affectedStreamsPercentThreshold: number;
2122

23+
readonly #minMosQuality: MosQuality;
24+
2225
constructor(params: VideoDecoderIssueDetectorParams = {}) {
2326
super(params);
2427
this.#volatilityThreshold = params.volatilityThreshold ?? 8;
2528
this.#affectedStreamsPercentThreshold = params.affectedStreamsPercentThreshold ?? 30;
29+
this.#minMosQuality = params.minMosQuality ?? MosQuality.BAD;
2630
}
2731

2832
performDetection(data: WebRTCStatsParsedWithNetworkScores): IssueDetectorResult {
@@ -32,7 +36,7 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
3236
];
3337

3438
const isBadNetworkHappened = allHistoricalStats
35-
.find((stat) => stat.networkScores.inbound !== undefined && stat.networkScores.inbound <= MosQuality.BAD);
39+
.find((stat) => stat.networkScores.inbound !== undefined && stat.networkScores.inbound <= this.#minMosQuality);
3640

3741
if (isBadNetworkHappened) {
3842
// do not execute detection on historical stats based on bad network quality

0 commit comments

Comments
 (0)