Skip to content

[STREAM-151] Report media stats to server#991

Open
millerx wants to merge 15 commits intodevelopfrom
STREAM-151
Open

[STREAM-151] Report media stats to server#991
millerx wants to merge 15 commits intodevelopfrom
STREAM-151

Conversation

@millerx
Copy link
Copy Markdown
Collaborator

@millerx millerx commented Apr 14, 2026

MERGE CHECKLIST

  • Tests have been updated, added, or removed and the testing matrix has passed.
  • Documentation has been updated or added.
  • Changelog has been updated with ticket or issue number, link to the ticket, and a description of the changes.
  • Branch has been built in the BitBucket wrapper repository.
  • Pull request title is formatted as [STREAM-<ticket number>] - <description of changes> or [<issue number>] - <description of changes>.
  • Release pull requests include someone from the PureScale team for approval.
  • Build release branch in wrapper repository and make sure it is tagged with next on npm.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jon is going to help me with the package-lock.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and just fixed it myself because I think that might be why the GitHub Action is failing. Basically it pointed a bunch of things to nexus/jfrog, probably because your npm is setup that way. For our open source stuff, your npm registry has to be setup for the default https://registry.npmjs.org/.

tl;dr - I fixed the lockfile, it was pointing to nexus/jfrog for some dependencies probably because you have a .npmrc under your user configured that way for Bitbucket stuff.

Chris Miller and others added 2 commits April 14, 2026 11:53
Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
Comment thread changelog.md

### Added
* [STREAM-1056](https://inindca.atlassian.net/browse/STREAM-1056) Added documentation for live screen monitoring functionality
* [STREAM-151](https://inindca.atlassian.net/browse/STREAM-151) - Send media statistics to the server. Aggregates stats, calculates a MOS score and pushes at regular intervals.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this up to under Unreleased? Looks like it got added to v13.0.0 when you rebased.

Comment thread src/stats-aggregator.ts
return;
}

if (stats.tracks.length === 0 || stats.remoteTracks.length === 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More of a question to the team - is there any value in adding some logging before these early returns?

Comment thread src/stats-aggregator.ts
}

private onSessionStarted(session: IExtendedMediaSession) {
if (session == this.session) {
Copy link
Copy Markdown
Collaborator

@zservies zservies Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ===.

Comment thread src/stats-aggregator.ts

const roundTripTimeSum = totalRtt - this.baselineRtt;
const roundTripTimeMeasurements = totalRttMeasurements - this.baselineRttMeasurements;
const averageRoundTripTime = roundTripTimeSum / roundTripTimeMeasurements;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a guard around roundTripeTimeMeasurements so we don't end up dividing by 0? I'm not sure if that's a valid scenario.

Comment thread src/stats-aggregator.ts
private stopGatheringStats() {
if (this.statsGatherer) {
this.statsGatherer.off('stats', this.boundStatsHandler);
this.statsGatherer = null;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because statsGatherer?: StatsGatherer is optional, it can only be of type StatsGatherer or undefined. This probably doesn't throw an error for us right now because we have strictNullChecks: false in our typescript config, but this should technically be undefined instead of null.

Comment thread src/stats-aggregator.ts
}

private startGatheringStats() {
this.statsGatherer = new StatsGatherer(this.session.peerConnection)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check for an existing stats gatherer before creating a new one so we don't end up with any leaks.

if (this.statsGatherer) {
    this.logger.warn('Cannot create stats gatherer, one already exists');
    return;
}

Or we should call this.stopStatsGatherer() to cleanup any potential existing gatherers before creating another.

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