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: add experimental pixel diff selector behind a flag #786

Merged
merged 8 commits into from
Jul 27, 2021

Conversation

brandonocasey
Copy link
Contributor

Simplify and improve our resolution selection by selecting the closest resolution to the player, rather than using one larger or the exact size.

stableSort(haveResolution, (left, right) => left.width - right.width);

// if we have the exact resolution as the player use it
const resolutionBestRepList = haveResolution.filter((rep) => rep.width === playerWidth && rep.height === playerHeight);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need this now that we use pixelDiff since the pixelDiff will be 0 for such a playlist.

@brandonocasey brandonocasey force-pushed the fix/lowest-pixel-diff branch 3 times, most recently from 124ea78 to 0b58f53 Compare March 31, 2020 19:03
const playlists = this.masterPlaylistController.master().playlists;
const currenstPlaylist = this.masterPlaylistController.media();

return playlists.find((playlist) => playlist !== currenstPlaylist);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made these more dynamic

@@ -1059,7 +1059,7 @@ QUnit.test('selects a playlist below the current bandwidth', function(assert) {
});

QUnit.test(
'selects a primary rendtion when there are multiple rendtions share same attributes',
'selects a primary rendition when there are multiple rendtions share same attributes',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

spelling

@brandonocasey
Copy link
Contributor Author

Will write tests for this if we decide to go with this change.

@brandonocasey brandonocasey force-pushed the fix/lowest-pixel-diff branch 2 times, most recently from 92a04a9 to ddbfb5e Compare April 1, 2020 18:54
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
test/master-playlist-controller.test.js Outdated Show resolved Hide resolved
@@ -1219,12 +1219,12 @@ QUnit.test('selects the correct rendition by tech dimensions', function(assert)

assert.deepEqual(
playlist.attributes.RESOLUTION,
{width: 960, height: 540},
{width: 396, height: 224},
Copy link
Contributor

Choose a reason for hiding this comment

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

Although in many cases, particularly when there's a good number of available renditions, selecting the closest rendition rather than the closest plus one rendition makes sense, in a case like this one, the quality will be pretty degraded compared to the previous logic. We may want to make a reasonable allotment for how many fewer pixels we'll allow before just using the higher rendition, especially if there's plenty of bandwidth available to accommodate.

@gkatsev
Copy link
Member

gkatsev commented Apr 10, 2020

I think we want to hold off on merging this until we get closer to working on our ABR epic.

@gkatsev gkatsev added this to the 2.1 milestone May 21, 2020
@gkatsev gkatsev modified the milestones: 2.1, 2.2 Jun 12, 2020
@gkatsev gkatsev changed the base branch from master to main June 19, 2020 16:49
@stale
Copy link

stale bot commented Aug 22, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the outdated label Aug 22, 2020
@gkatsev gkatsev removed the outdated label Aug 27, 2020
@gkatsev gkatsev modified the milestones: 2.2, ABR Sep 10, 2020
@stale
Copy link

stale bot commented Dec 12, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@codecov
Copy link

codecov bot commented Apr 8, 2021

Codecov Report

Merging #786 (f10d133) into main (b3d1ec0) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #786      +/-   ##
==========================================
+ Coverage   86.47%   86.49%   +0.01%     
==========================================
  Files          39       39              
  Lines        9577     9590      +13     
  Branches     2210     2214       +4     
==========================================
+ Hits         8282     8295      +13     
  Misses       1295     1295              
Impacted Files Coverage Δ
src/videojs-http-streaming.js 90.30% <ø> (ø)
src/master-playlist-controller.js 94.60% <100.00%> (+<0.01%) ⬆️
src/playlist-selectors.js 87.05% <100.00%> (+0.98%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3d1ec0...f10d133. Read the comment docs.

@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@brandonocasey brandonocasey changed the title fix: use the closest resolution to the player feat: add experimental pixel diff selector Jul 13, 2021
'liveui',
'pixel-diff-selector'
].forEach(function(name) {
stateEls[name].addEventListener('change', function(event) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

merged all the handlers that reload the player, since I was adding a new one.

@brandonocasey brandonocasey changed the title feat: add experimental pixel diff selector feat: add experimental pixel diff selector behind a flag Jul 16, 2021
Copy link
Contributor

@gesinger gesinger left a comment

Choose a reason for hiding this comment

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

Did we want to note this in the README?

src/playlist-selectors.js Outdated Show resolved Hide resolved
Comment on lines 293 to 294
// find the smallest variant that is larger than the player
// if there is no match of exact resolution
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is exactly the same as the one for resolutionPlusOneList, but the behavior is different. Maybe each should call out why they're choosing each method?

@@ -296,7 +323,9 @@ export let simpleSelector = function(
if (chosenRep && chosenRep.playlist) {
let type = 'sortedPlaylistReps';

if (resolutionPlusOneRep) {
if (leastPixelDiffRep) {
type = 'leastPixelDiffRep';
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we call it leastPixelDiffRep should we name the property experimentalLeastPixelDiffSelector?

@brandonocasey
Copy link
Contributor Author

I don't think that we want to add it to the README. We haven't added any of the other experimental options. I think we just need to do an a/b test with them and make them the default or remove them.

gesinger
gesinger previously approved these changes Jul 27, 2021
src/playlist-selectors.js Outdated Show resolved Hide resolved
@brandonocasey brandonocasey merged commit a0c0359 into main Jul 27, 2021
@brandonocasey brandonocasey deleted the fix/lowest-pixel-diff branch July 27, 2021 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants