Skip to content

Commit 69b2c50

Browse files
fix: code review
1 parent 642c6a4 commit 69b2c50

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

src/detectors/MissingStreamDataDetector.ts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default class MissingStreamDataDetector extends BaseIssueDetector {
6363
unvisitedTrackIds.forEach((trackId) => {
6464
const lastMarkedAt = this.#lastMarkedAt.get(trackId);
6565
if (lastMarkedAt && Date.now() - lastMarkedAt > this.#timeoutMs) {
66-
this.removeMarkIssue(trackId);
66+
this.removeMarkedIssue(trackId);
6767
}
6868
});
6969

@@ -93,29 +93,27 @@ export default class MissingStreamDataDetector extends BaseIssueDetector {
9393
return;
9494
}
9595

96-
if (MissingStreamDataDetector.isAllBytesReceivedDidntChange(inboundItem.bytesReceived, prevInboundItems)) {
97-
const hasIssue = this.markIssue(trackId);
98-
99-
if (!hasIssue) {
100-
return;
101-
}
102-
103-
const statsSample = {
104-
bytesReceivedDelta: 0,
105-
bytesReceived: inboundItem.bytesReceived,
106-
trackDetached: Boolean(inboundItem.track.detached),
107-
trackEnded: Boolean(inboundItem.track.ended),
108-
};
109-
110-
issues.push({
111-
type,
112-
reason,
113-
statsSample,
114-
trackIdentifier: trackId,
115-
});
116-
} else {
117-
this.removeMarkIssue(trackId);
96+
if (!MissingStreamDataDetector.isAllBytesReceivedDidntChange(inboundItem.bytesReceived, prevInboundItems)) {
97+
this.removeMarkedIssue(trackId);
98+
return;
99+
}
100+
101+
const issueMarked = this.markIssue(trackId);
102+
103+
if (!issueMarked) {
104+
return;
118105
}
106+
107+
const statsSample = {
108+
bytesReceived: inboundItem.bytesReceived,
109+
};
110+
111+
issues.push({
112+
type,
113+
reason,
114+
statsSample,
115+
trackIdentifier: trackId,
116+
});
119117
});
120118

121119
return issues;
@@ -161,7 +159,7 @@ export default class MissingStreamDataDetector extends BaseIssueDetector {
161159
return false;
162160
}
163161

164-
private removeMarkIssue(trackId: string): void {
162+
private removeMarkedIssue(trackId: string): void {
165163
this.#lastMarkedAt.delete(trackId);
166164
}
167165
}

0 commit comments

Comments
 (0)