Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

eugeny-dementev
Copy link

No description provided.

@eugeny-dementev eugeny-dementev force-pushed the TT-269-audio-video-missing branch 2 times, most recently from 7416eea to 6520a75 Compare December 24, 2024 10:33
Base automatically changed from keep-last-n-stats to master December 25, 2024 07:00
@eugeny-dementev eugeny-dementev marked this pull request as ready for review December 25, 2024 09:39
@eugeny-dementev eugeny-dementev changed the title feat: audio video stream missing data detector feat: TT-268 audio video stream missing data detector Dec 25, 2024
@eugeny-dementev eugeny-dementev changed the title feat: TT-268 audio video stream missing data detector feat: TT-26{8,9} audio video stream missing data detector Dec 25, 2024
@eugeny-dementev eugeny-dementev force-pushed the TT-269-audio-video-missing branch from 1a39ff9 to da3b55f Compare December 25, 2024 09:42
@eugeny-dementev eugeny-dementev changed the title feat: TT-26{8,9} audio video stream missing data detector feat: audio video stream missing data detector Dec 25, 2024
@eugeny-dementev eugeny-dementev changed the title feat: audio video stream missing data detector feat: audio video stream missing data detector Dec 25, 2024
src/WebRTCIssueDetector.ts Show resolved Hide resolved
}

export default class MissingStreamDataDetector extends BaseIssueDetector {
readonly #lastMarkedAt = new Map<string, number>();
Copy link
Collaborator

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 / )

Copy link
Author

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());
Copy link
Collaborator

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;
Copy link
Collaborator

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;

Copy link
Collaborator

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>(
Copy link
Collaborator

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);
Copy link
Collaborator

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,
Copy link
Collaborator

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?

Copy link
Author

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

Copy link
Author

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

@eugeny-dementev eugeny-dementev force-pushed the TT-269-audio-video-missing branch from 50a35ee to de8e19d Compare December 27, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants