MSE: Blink portion of non-preemptive eviction policy API #19581
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the second part of landing an experimental prototype of new
non-preemptive MSE eviction policies. Combined prototype CL is [1].
First part (Chromium portion) is [2].
This CL adds an experimental (MediaSourceExperimental) new MSE API to
modify the eviction policy of a SourceBuffer. Successful setting of the
eviction policy is constrained to only be allowed before the
SourceBuffer has processed its first initialization segment.
The pre-existing, now default, logic uses the "normal" policy. Two new
policies are added: "before-next-demuxed" and "before-current-gop". The
latter currently has no different behavior in the Chromium
implementation: it behaves precisely like the default "normal" policy.
Later CLs may refine or remove "before-current-gop".
"before-next-demuxed" enables new "infinite GOP" buffering scenarios,
where the keyframe interval might be extreme and prevent successful
buffering of an entire huge GOP if using the "normal" policy. As part of
the prepare append algorithm, "before-next-demuxed" removes anything
buffered before the next demuxed frame (including any previous buffered
ranges). Note that if the next demuxed position is not within any
buffered range, this policy may preserve buffered ranges earlier than
current media time. This allows for newly buffered GOPs for current
media time to have their keyframes preserved until they are demuxed.
This mode will fall-back to the "normal" policy if not enough space has
been freed to accommodate the newly appended data, and may emit quota
exception if even "normal" policy fails to free enough space.
Naming of the new eviction policies may change during
discussion/feedback on the incubation proposal/explainer, which also
needs updating to reflect design decisions taken during this prototype's
development so far. Versus the original explainer, this prototype:
Gives exception on changing the eviction policy after "first
initialization segment received flag" is true. Later spec smithing
could re-allow this, for instance, to switch back to "normal" to
accomplish a (deterministic) seek, if this limitation is undesired.
Prevents seeking if using "before-next-demuxed" eviction policy in an
active SourceBuffer. Seeking would introduce complexities such as
indeterminate behavior especially if asynch append, perhaps on worker
context, is concurrent with seek, and seek evicts all "partial GOPS"
whose keyframes are no longer buffered. Later spec smithing could
re-allow this if such indeterminacy is non-prohibitive.
Mechanism: HTMLME::seekable reports empty range if any
activeSourceBuffer is using before-next-demuxed.
set,clearLiveSeekableRange unchanged, since the ::seekable logic for
before-next-demuxed returns early with empty range
See the Chromium-side CL [2] for further discussion of some internal
range seeking/selection behavior that is retained even in
"before-next-demuxed".
[1] https://chromium-review.googlesource.com/c/chromium/src/+/1616976
[2] https://chromium-review.googlesource.com/c/chromium/src/+/1848364
Explainer (may still be the original one, that has since been
constrained to prevent seeking, for instance, by this prototype):
https://github.com/wicg/media-source/blob/mse-eviction-policies/mse-eviction-policies-explainer.md
BUG=963717
Change-Id: Ic1b4abc8f6de9b8012fb9b73e8fef8668c2a6c1a
Reviewed-on: https://chromium-review.googlesource.com/1847748
WPT-Export-Revision: d48bf88d1cb6fcb82a76aa1a0490117b15544cb9