-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: audio video stream missing data detector #30
base: master
Are you sure you want to change the base?
Conversation
7416eea
to
6520a75
Compare
1a39ff9
to
da3b55f
Compare
} | ||
|
||
export default class MissingStreamDataDetector extends BaseIssueDetector { | ||
readonly #lastMarkedAt = new Map<string, number>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this property does not explicitly says what it is used for. I'd suggest adding context to the name about track (e.g. tracksToLastMarkedAt / trackToLastMarkedAtMap / )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That value mainly used to limit how often issue reported. Not sure how to name it properly. I've took it mostly intact from FrozenVideoTrackDetector
)); | ||
} | ||
|
||
const unvisitedTrackIds = new Set(this.#lastMarkedAt.keys()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name seems to be confusing. What if to skip using a variable and inline
(new Set(this.#lastMarkedAt.keys())).forEach(...)
or to rename the variable
|
||
constructor(params: MissingStreamDetectorParams = {}) { | ||
super(); | ||
this.#timeoutMs = params.timeoutMs ?? 10_000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timeoutMs is used for marked tracks cleanup and for marking tracks (in conditions), don't we need to add 2 separate props for cleanup and for mark tracks ttl?
const { audio: { inbound: newAudioInbound } } = data; | ||
const prevVideoInbound = prevData?.video.inbound; | ||
const prevAudioInbound = prevData?.audio.inbound; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary empty line
): IssueDetectorResult { | ||
const issues: IssuePayload[] = []; | ||
|
||
const mapStatsByTrackId = (items: CommonParsedInboundStreamStats[]) => new Map<string, CommonParsedInboundStreamStats>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this function to a separate static method / helper?
|
||
|
||
if (bytesReceivedDelta === 0 && !inboundItem.track.detached && !inboundItem.track.ended) { | ||
const hasIssue = this.markIssue(trackId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
markIssue() seems to only mark the issue, but actually it checks if it should mark it. What about separating of the logic into 2 methods: checkShouldMarkIssue / markIssue?
const statsSample = { | ||
bytesReceivedDelta, | ||
bytesReceived: inboundItem.bytesReceived, | ||
trackDetached: inboundItem.track.detached, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this props are gonna be constants (always true), do we need to add them to the stats sample?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to show in statsSample that these values are not true
. So it's visible that stream is in fact alive and active, just has no data going through it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've no converted the undefined
to false
. Not sure if it's correct
50a35ee
to
de8e19d
Compare
No description provided.