New issue
Advanced search Search tips

Issue 639144 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Update MSE duration change, endOfStream, and buffered behavior to match spec

Project Member Reported by wolenetz@chromium.org, Aug 18 2016

Issue description

Spec change https://github.com/w3c/media-source/pull/154 is expected to land soon. Chrome is already not compliant with either the before or after #154 state. Assuming #154 lands, Chrome MSE needs:

* updated endOfStream behavior around calculation of highest end time (using highest track buffer range end time, not highest intersected track buffer range (SourceBuffer.buffered) end time, across all SourceBuffers.
* updated duration change algorithm behavior, which "bumps up" the desired duration to a similarly calculated highest end time.
* test that:
1) If current duration is D, highest track buffer range end time E<D:
 a) setting duration attribute to D is no-op (with no 'durationchange')
 b) setting duration attribute to E results with duration==E and 'durationchange' event enqueued
 c) setting duration attribute to X<E, X > highest buffered PTS, results with duration==E and 'durationchange' fired
2) If current duration is D, highest track buffer range end time E==D:
 a) setting duration attribute to D is no-op (with no 'durationchange')
 b) setting duration attribute to X < D, X > highest buffered PTS, results with duration "bumped back up" to D *and* 'durationchange' event fired

Note: 1c and 2b are different than before #154 and also different than current Chromium implementation.

Note also that the current capping of the highest buffered range end time to be duration *should* be unnecessary once implementation matching #154 lands in Chromium; suggest that such capping be replaced with DCHECKs.
 
Specifically, the "Truncating the duration throws an InvalidStateError exception when new duration is less than a buffered coded frame presentation time" subtest in upstream https://github.com/w3c/web-platform-tests/pull/3655 exposes this current lack of compliance in Chrome.
See also case 2 in issue 604353 comment 14.

I'm also wondering: what if currentTime progressed into a buffered region, that region was then remove()'ed, and endOfStream() resulted in reducing duration below where currentTime had reached: what should happen in this case spec-wise?
@#2, there's no ambiguity actually: per https://www.w3.org/TR/html51/semantics-embedded-content.html#durationChange, a seek to the new duration should occur.
See the TODO (in CL CR now): https://chromium-review.googlesource.com/c/606683/1/third_party/WebKit/Source/modules/mediasource/MediaSource.cpp#742

Such refactoring would best be done as part of fixing this bug IMHO.

Sign in to add a comment