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

Fixes demo graphs for improved bandwidth estimation #4904

Merged
merged 12 commits into from Feb 20, 2023

Conversation

silltho
Copy link
Contributor

@silltho silltho commented Sep 14, 2022

Why is this Pull Request needed?

The demo calculates the bandwidth for each fragment separately from the abr-controller. Therefore it needs to be updated to ensure that the same values are used for the bandwidth estimation and the bandwidth graph on the demo page.

Are there any points in the code the reviewer needs to double check?

Resolves issues:

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

demo/main.js Show resolved Hide resolved
demo/main.js Show resolved Hide resolved
demo/main.js Outdated
Comment on lines 547 to 550
if (data.frag.type !== 'main' || data.frag.sn === 'initSegment') {
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume this check was based on this code.

// Only count non-alt-audio frags which were actually buffered in our BW calculations
    if (frag.type !== PlaylistLevelType.MAIN || frag.sn === 'initSegment') {
      return;
    }

This is to only use the larger segments to get a more accurate line speed in our EWMA sample. However, this data should have all segments so I'm not sure this is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume this check was based on this code.

Exactly.

This is to only use the larger segments to get a more accurate line speed in our EWMA sample. However, this data should have all segments so I'm not sure this is necessary.

That's a good question. I used the demo to verify the changes made to the bw estimation and found it counterintuitive that the graph shows different data than the bw estimator uses internally. Adding console.logs instead to get a better understanding of what is happening.

However I can see that the graph might show the bandwidth of every request regarding what is being selected for estimation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think making the change so the bitrate is calculated the same is a good change and should definitely be made.

What do you think about simply grabbing the calculated EWMA and showing it on the metrics page? That way you would get the exact data, and we wouldn't need to re-calculate the demo page if we ever changed the way the metric was calculated.

demo/main.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@itsjamie itsjamie left a comment

Choose a reason for hiding this comment

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

I believe I understand that you want the bandwidth (bw) value calculated in the event to accurate represent what hls.js would have sampled into the EWMA class, is that accurate?

If that's true, then I think the direction you have with the calculation for processingMs and using stats.loaded is on track.

Some of the early exits are changing which fragments will be stored as data on the demo page, which I don't think is ideal.

@silltho
Copy link
Contributor Author

silltho commented Nov 25, 2022

Thanks for the review i will work through your feedback and update the PR next week.

@silltho
Copy link
Contributor Author

silltho commented Nov 28, 2022

Some of the early exits are changing which fragments will be stored as data on the demo page, which I don't think is ideal.

Agree. What do you think would be good solution? Adding a new graph comes to my mind.

@robwalch robwalch force-pushed the feature/estimate-ttfb-fix-part-stats-improve-abr branch from fe62282 to b4b3bfd Compare November 28, 2022 22:50
@itsjamie
Copy link
Collaborator

@silltho I think you might need to rebase against feature/estimate-ttfb-fix-part-stats-improve-abr to clean up some of the conflicts.

@itsjamie
Copy link
Collaborator

Agree. What do you think would be good solution? Adding a new graph comes to my mind.

Yeah, rather than an entirely new graph, what do you think about directly getting the EWMA value and add it directly on the bitrate graph as a new value? Leaving the bitrate graph showing all requests, and the moving bitrate. This would allow you to easily see the difference between the raw bitrate/s average required, versus what the EWMA is reporting in code for selection.

@silltho silltho force-pushed the bugfix/demo-bandwidth-calculation branch from 713664d to ec2d213 Compare December 2, 2022 11:44
@silltho silltho force-pushed the bugfix/demo-bandwidth-calculation branch from ec2d213 to 4507a0c Compare December 2, 2022 11:55
@silltho
Copy link
Contributor Author

silltho commented Dec 5, 2022

@itsjamie I've added the estimated bandwidth as yellow line to the bitrate graph. I had to to increase the height of the graph (not sure if this has an impact on something)

@robwalch robwalch force-pushed the feature/estimate-ttfb-fix-part-stats-improve-abr branch 2 times, most recently from 6f19423 to 1672028 Compare January 12, 2023 18:41
@robwalch robwalch added this to the 1.4.0 milestone Jan 18, 2023
@robwalch robwalch deleted the branch video-dev:master January 18, 2023 18:55
@robwalch robwalch closed this Jan 18, 2023
@robwalch robwalch reopened this Jan 21, 2023
@robwalch robwalch changed the base branch from feature/estimate-ttfb-fix-part-stats-improve-abr to master January 21, 2023 02:38
@itsjamie
Copy link
Collaborator

Just did a rebase and fixed the conflicts, looks like the core changes have all been merged already, so nice finding those @silltho. I'm running the demo changes locally while the CI runs.

Copy link
Collaborator

@itsjamie itsjamie left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you.

:shipit:

@itsjamie itsjamie merged commit 26d2881 into video-dev:master Feb 20, 2023
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.

None yet

3 participants