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

fix: user can pick variant track/texttrack from streaming event #3459

Merged
merged 4 commits into from
Jul 10, 2021

Conversation

kocoten1992
Copy link
Contributor

Description

fix #3448

in 2.5.1, we can pick variant track from manifest alone.

this functionality is broken from v3.

this patch allowed user to pick variant track from streaming event.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

@joeyparrish
Copy link
Member

I think this fix is too broad. I'm not convinced that it's correct to keep the active track for all the various ways and times that chooseVariant_ is called.

Instead, you should make the call right after the streaming event conditional. If there's no active track, you would call chooseVariant_. Otherwise, skip it.

Does this help?

allowed user to pick variant track from streaming event
@kocoten1992
Copy link
Contributor Author

@joeyparrish is this what you mean ? PTAL.

lib/player.js Outdated Show resolved Hide resolved
lib/player.js Outdated Show resolved Hide resolved
@kocoten1992
Copy link
Contributor Author

hi @joeyparrish , thanks for the suggestion, js have such a nice gem, also I've fix style - it pass python3 build/check.py, PTAL

lib/player.js Show resolved Hide resolved
@kocoten1992 kocoten1992 changed the title fix: pick variant track from streaming event fix: user can pick variant track/texttrack from streaming event Jun 10, 2021
@kocoten1992
Copy link
Contributor Author

hi @joeyparrish, PTAL

lib/player.js Show resolved Hide resolved
lib/player.js Outdated Show resolved Hide resolved
@kocoten1992
Copy link
Contributor Author

@joeyparrish , PTAL, there is one fail test, https://github.com/google/shaka-player/blob/master/test/player_unit.js#L2001-L2005, I've not dig into it yet, but is it fail because this is a new case for it ?

Chrome 91.0.4472.101 (Linux x86_64) Player tracks chooses the configured text language and role at start FAILED
        Expected $.id = 50 to equal 52.
        Expected $.language = 'es' to equal 'en'.
	Expected $.roles.length = 0 to equal 1.
	Expected $.roles[0] = undefined to equal 'commentary'.
	Error: Expected $.id = 50 to equal 52.
	Expected $.language = 'es' to equal 'en'.
	Expected $.roles.length = 0 to equal 1.
	Expected $.roles[0] = undefined to equal 'commentary'.
	    at <Jasmine>
	    at _callee33$ (test/player_unit.js:2001:36 <- test/player_unit.js:2821:44)
	    at tryCatch (node_modules/babel-polyfill/dist/polyfill.js:6900:40)
	    at Generator.invoke [as _invoke] (node_modules/babel-polyfill/dist/polyfill.js:7138:22)

Copy link
Member

@joeyparrish joeyparrish left a comment

Choose a reason for hiding this comment

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

Sorry I overlooked your previous comment. Your change breaks an existing test case. As far as I can tell, the test case is still valid, and you've changed the behavior. The test case shows that the initial choice is based on the configuration of language and role preferences. This is an important behavior.

I will see if I can identify the issue, and if so, I'll suggest a fix.

@shaka-bot
Copy link
Collaborator

Test Failure:

Chrome 91.0.4472.114 (Linux x86_64)
  Player tracks chooses the configured text language and role at start FAILED
    Expected $.id = 50 to equal 52.
    Expected $.language = 'es' to equal 'en'.
    Expected $.roles.length = 0 to equal 1.
    Expected $.roles[0] = undefined to equal 'commentary'.
    Error: Expected $.id = 50 to equal 52.
    Expected $.language = 'es' to equal 'en'.
    Expected $.roles.length = 0 to equal 1.
    Expected $.roles[0] = undefined to equal 'commentary'.
        at <Jasmine>
        at _callee33$ (test/player_unit.js:2001:36 <- test/player_unit.js:2821:44)
        at tryCatch (node_modules/babel-polyfill/dist/polyfill.js:6900:40)
        at Generator.invoke [as _invoke] (node_modules/babel-polyfill/dist/polyfill.js:7138:22)

Failed 1 tests, passed 2097, skipped 33

@joeyparrish
Copy link
Member

What I'm seeing as I debug this is:

  1. Before the test runs, there is a beforeEach section that sets a default config and loads default content that is common to most tests in this group.
  2. In this particular test, we then set a different config and reload the content, to show that the config has an effect.
  3. When this happens, Player thinks that it already has active streams, and therefore doesn't choose new ones based on the config. This seems wrong, and like it is probably not your fault.
  4. This happens even if I await player.unload() at the top of the test. This seems wrong, too, and also unlikely to be caused by your change.

I'm trying to track down why this happens. But I'm fairly sure it has always been this way, and that your change merely uncovered it. Without your change, we would always re-evaluate the initial track selection, so the fact that there was an "active" track from a previous load() did not matter before.

@joeyparrish
Copy link
Member

Everything I said above is only true in the environment of this unit test. There, we override streamingEngine with a fake, and one that persists. Therefore the active tracks are persisting as well. I need to fix the fake to release its track list when destroy() is called. That should make it behave more like the real thing, and that should make the test pass again.

@joeyparrish
Copy link
Member

I have fixes for this in review internally. When they are merged, I will merge this PR. Thanks!

@joeyparrish joeyparrish added this to the v3.2 milestone Jul 9, 2021
@joeyparrish joeyparrish added type: bug Something isn't working correctly priority: P2 Smaller impact or easy workaround priority: P1 Big impact or workaround impractical; resolve before feature release and removed priority: P2 Smaller impact or easy workaround labels Jul 9, 2021
shaka-bot pushed a commit that referenced this pull request Jul 10, 2021
Player unit tests use a fake StreamingEngine that persists between
loads.  Some tests then load() multiple times, which causes calls to
destroy() on the fake.

But the fake StreamingEngine was not releasing its active stream
references on destroy(), leading to a brittle test that broke when
PR #3459 was introduced.

This fixes the fake to release active streams between loads().

Change-Id: Ifea5234863aeb976ddc45c825ef79342a176bc2f
@joeyparrish joeyparrish merged commit 760161f into shaka-project:master Jul 10, 2021
@joeyparrish
Copy link
Member

Thanks!

shaka-bot pushed a commit that referenced this pull request Jul 10, 2021
Just as we reset text language and role, we should also reset forced
sub state between load() calls.

Discovered while debugging PR #3459.

Change-Id: I22ef29cb6b14e02ee70503595b1303389260a633
joeyparrish added a commit that referenced this pull request Jul 13, 2021
Player unit tests use a fake StreamingEngine that persists between
loads.  Some tests then load() multiple times, which causes calls to
destroy() on the fake.

But the fake StreamingEngine was not releasing its active stream
references on destroy(), leading to a brittle test that broke when
PR #3459 was introduced.

This fixes the fake to release active streams between loads().

Change-Id: Ifea5234863aeb976ddc45c825ef79342a176bc2f
joeyparrish added a commit that referenced this pull request Jul 13, 2021
Just as we reset text language and role, we should also reset forced
sub state between load() calls.

Discovered while debugging PR #3459.

Change-Id: I22ef29cb6b14e02ee70503595b1303389260a633
joeyparrish pushed a commit that referenced this pull request Jul 13, 2021
In v2.5, we could choose a track explicitly from the "streaming" event.  In v3, this was broken.  Now the player will not choose any tracks automatically if explicit tracks were chosen by the app during the "streaming" event.

Closes #3448

Backported to v3.1.x

Change-Id: I61aad438be0d71e0ba21c9473e03850bb210fcef
joeyparrish added a commit that referenced this pull request Jul 13, 2021
Player unit tests use a fake StreamingEngine that persists between
loads.  Some tests then load() multiple times, which causes calls to
destroy() on the fake.

But the fake StreamingEngine was not releasing its active stream
references on destroy(), leading to a brittle test that broke when
PR #3459 was introduced.

This fixes the fake to release active streams between loads().

Change-Id: Ifea5234863aeb976ddc45c825ef79342a176bc2f
joeyparrish pushed a commit that referenced this pull request Jul 13, 2021
In v2.5, we could choose a track explicitly from the "streaming" event.  In v3, this was broken.  Now the player will not choose any tracks automatically if explicit tracks were chosen by the app during the "streaming" event.

Closes #3448

Backported to v3.1.x

Change-Id: I61aad438be0d71e0ba21c9473e03850bb210fcef
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

selectVariantTrack on streaming event doesn't work anymore
3 participants