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

MSE-in-Workers: Track enable/selection change behavior needs clarity #281

Open
wolenetz opened this issue Jun 25, 2021 · 1 comment
Open
Assignees
Labels
TPAC2024 Topic for discussion at TPAC 2024
Milestone

Comments

@wolenetz
Copy link
Member

wolenetz commented Jun 25, 2021

MSE-in-Workers feature issue is #175

The "Changes to selected/enabled track state" section makes sense in the REC v1 spec for Window-only MSE and HTMLMediaElement.

This issue tracks figuring out what to do with such state management if MSE is in a DedicatedWorker, while the HTMLMediaElement remains in Window.

Assuming apps might need information about tracks in either context, and similarly may wish to change the state of them, how best can this be done in the specification?

Scenario:
Simultaneous track selection of different video tracks in each of the Window (media element) and DedicatedWorker (MSE): These changes can affect what the extended HTMLMediaElement's seekable and buffered attributes return:

  • A track, when selected, should (at some point soon) ensure the track's SourceBuffer is or becomes a member of the activeSourceBuffers. Likewise, a deselected track should (at some point soon) ensure that if there are no other selected/enabled/etc tracks from the deselected track's SourceBuffer, that that SourceBuffer is removed from the activeSourceBuffers list.
  • seekable and buffered are conditioned upon information from the current activeSourceBuffers list.
  • So, simultaneous track changes can race under the message passing mechanism [*].
  • Even with a single track change by the Window side, the round-trip of potentially updated buffered and seekable information could be delayed.

It's probable that this scenario will not be solved by forcing all implementations to make such changes atomically[*]. While some do (like Chrome's prototype implementation), the solution might be a non-normative note that apps may need to be aware of how potential delays in buffered, seekable, etc information resulting from scenarios like this might occur. A potential handler might need to round-trip the necessary information on the application side with message passing there.

[*] Internally, a message posting/handling mechanism is described by the MSE-in-Worker spec (in my upcoming PR for the initial spec draft, there will be a "Cross-context communication model" section describing that mechanism as well as allowance for implementations to use potentially faster locking and shared memory). In Chrome's prototype implementation so far (apart from this track stuff which is not yet fully implemented in worker), micro-locking is used for most of the communication, rather than the potentially slower message passing.

[edited the last paragraph for clarity June 25 2021]

wolenetz added a commit to wolenetz/media-source that referenced this issue Jun 26, 2021
Makes sourceBuffer {A/V/T}Track attribute language for MSE-in-Worker
normative (formerly was in a non-normative note).

BIG TODO/in-progress: Updates initialization segment received algorithm to create
cross-context track clones on track creation.

BIG TODO: Updates removeSourceBuffer language to remove cross-context
track clones on SourceBuffer removal from its parent media source.

BIG TODO: Updates the "Changes to selected/enabled track state" section
to describe cross-context track clone changes. See also w3c#281.

Also fixes a couple minor typos.
wolenetz added a commit to wolenetz/media-source that referenced this issue Jun 29, 2021
Makes sourceBuffer {A/V/T}Track attribute language for MSE-in-Worker
normative (formerly was in a non-normative note).

Updates MSE-in-Worker version of the initialization segment received
algorithm to create cross-context track clones on track creation, and to
conditionally update the cross-context media element's readyState.

BIG TODO: Updates removeSourceBuffer language to remove cross-context
track clones on SourceBuffer removal from its parent media source.

BIG TODO: Updates the "Changes to selected/enabled track state" section
to describe cross-context track clone changes. See also w3c#281.

Also fixes a couple minor typos.
wolenetz added a commit to wolenetz/media-source that referenced this issue Jun 29, 2021
Makes sourceBuffer {A/V/T}Track attribute language for MSE-in-Worker
normative (formerly was in a non-normative note).

Updates MSE-in-Worker version of the initialization segment received
algorithm to create cross-context track clones on track creation, and to
conditionally update the cross-context media element's readyState.

Updates MSE-in-Worker version of removeSourceBuffer language to remove
relevant cross-context track mirrors on SourceBuffer removal from its
parent media source.

BIG TODO: Updates the "Changes to selected/enabled track state" section
to describe cross-context track clone changes. See also w3c#281.

Also fixes a couple minor typos.
wolenetz added a commit to wolenetz/media-source that referenced this issue Jun 29, 2021
Makes sourceBuffer {A/V/T}Track attribute language for MSE-in-Worker
normative (formerly was in a non-normative note).

Updates MSE-in-Worker version of the initialization segment received
algorithm to create cross-context track clones on track creation, and to
conditionally update the cross-context media element's readyState.

Updates MSE-in-Worker version of removeSourceBuffer language to remove
relevant cross-context track mirrors on SourceBuffer removal from its
parent media source.

Updates the "Changes to selected/enabled track state" section to
describe Window/DedicatedWorker track state changes. See also w3c#281.

Also fixes a couple minor typos.
wolenetz added a commit to wolenetz/media-source that referenced this issue Jun 30, 2021
Makes sourceBuffer {A/V/T}Track attribute language for MSE-in-Worker
normative (formerly was in a non-normative note).

Updates MSE-in-Worker version of the initialization segment received
algorithm to create cross-context track clones on track creation, and to
conditionally update the cross-context media element's readyState.

Updates MSE-in-Worker version of removeSourceBuffer language to remove
relevant cross-context track mirrors on SourceBuffer removal from its
parent media source.

Updates the "Changes to selected/enabled track state" section to
describe Window/DedicatedWorker track state changes. See also w3c#281.

Also fixes a couple minor typos.
@wolenetz wolenetz self-assigned this Sep 3, 2021
@wolenetz wolenetz added this to the V2 milestone Sep 3, 2021
@wolenetz wolenetz added the agenda Topic should be discussed in a group call label Sep 3, 2021
@wolenetz
Copy link
Member Author

wolenetz commented Sep 3, 2021

Requesting this be discussed at Sept 14 Media WG meeting.

@dalecurtis dalecurtis modified the milestones: V3, V2 Mar 14, 2023
@chrisn chrisn removed the agenda Topic should be discussed in a group call label Apr 5, 2023
@chrisn chrisn added the TPAC2024 Topic for discussion at TPAC 2024 label Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TPAC2024 Topic for discussion at TPAC 2024
Projects
None yet
Development

No branches or pull requests

3 participants