Closed Bug 1362165 Opened 7 years ago Closed 7 years ago

[MSE] readyState may be HAVE_NOTHING after init segment appended

Categories

(Core :: Audio/Video: Playback, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jya, Assigned: jya)

References

(Blocks 2 open bugs)

Details

Attachments

(12 files)

59 bytes, text/x-review-board-request
mozbugz
: review+
Details
59 bytes, text/x-review-board-request
mozbugz
: review+
Details
59 bytes, text/x-review-board-request
mozbugz
: review+
Details
59 bytes, text/x-review-board-request
mozbugz
: review+
Details
59 bytes, text/x-review-board-request
mozbugz
: review+
Details
59 bytes, text/x-review-board-request
mozbugz
: review+
Details
59 bytes, text/x-review-board-request
jwwang
: review+
Details
59 bytes, text/x-review-board-request
jwwang
: review+
Details
59 bytes, text/x-review-board-request
jwwang
: review+
Details
59 bytes, text/x-review-board-request
mozbugz
: review+
Details
59 bytes, text/x-review-board-request
mozbugz
: review+
Details
59 bytes, text/x-review-board-request
mozbugz
: review+
Details
When appending an init segment, we may fire "updateend" though readyState is still HAVE_NOTHING Per spec, readyState must be moved to HAVE_METADATA: https://w3c.github.io/media-source/#sourcebuffer-init-segment-received step 6: "6. If the HTMLMediaElement.readyState attribute is HAVE_NOTHING, then run the following steps: " And only after returning from the "init segment received" algorithm should updateend event be fired. This is the cause of some mochitest intermittent failure (such as test_TruncatedDuration.html) and likely why we have some reports about streams not starting. The reason for this is that many live streams start by seeking to a particular position right after appending some data. However, if readyState is HAVE_NOTHING, then the seek process is to be aborted: https://dev.w3.org/html5/spec-preview/media-elements.html#dom-media-seek "If the media element's readyState is HAVE_NOTHING, abort these steps."
Bug 879717 added a change that force the readyState to HAVE_METADATA if nothing has been painted yet. This is against the MSE spec that only defines the state based on the buffered range, regardless of what got painted.
Blocks: 879717
Depends on: 1363668
Blocks: 1367993
Attachment #8871942 - Flags: review?(gsquelart) → review+
Comment on attachment 8871943 [details] Bug 1362165: P2. Don't expect that all data has been processed after metadata. https://reviewboard.mozilla.org/r/143456/#review147294
Attachment #8871943 - Flags: review?(gsquelart) → review+
Comment on attachment 8871945 [details] Bug 1362165: P4. Don't assume the duration found when reading metadata will be the final one. https://reviewboard.mozilla.org/r/143460/#review147298
Attachment #8871945 - Flags: review?(gsquelart) → review+
Comment on attachment 8871946 [details] Bug 1362165: P5. Don't assume that when stalling all data has been loaded. https://reviewboard.mozilla.org/r/143462/#review147300
Attachment #8871946 - Flags: review?(gsquelart) → review+
Comment on attachment 8871947 [details] Bug 1362165: P6. Only use sourcebuffer again once previous operation completed. https://reviewboard.mozilla.org/r/143464/#review147302
Attachment #8871947 - Flags: review?(gsquelart) → review+
Attachment #8871953 - Flags: review?(gsquelart) → review+
Comment on attachment 8871948 [details] Bug 1362165: P7. Only complete appendBuffer once readyState has changed. https://reviewboard.mozilla.org/r/143466/#review147372 ::: dom/media/mediasource/SourceBuffer.h:169 (Diff revision 1) > uint32_t aLength, > ErrorResult& aRv); > > void AppendDataCompletedWithSuccess(const SourceBufferTask::AppendBufferResult& aResult); > void AppendDataErrored(const MediaResult& aError); > + void ResumeAppendDataCompleted(); This function is used nowhere in this commit.
Attachment #8871948 - Flags: review?(jwwang) → review+
Comment on attachment 8871949 [details] Bug 1362165: P8. Fix mochitests. https://reviewboard.mozilla.org/r/143468/#review147374 ::: dom/media/mediasource/test/test_DurationChange.html:22 (Diff revision 1) > var sb = ms.addSourceBuffer("video/webm"); > > fetchWithXHR("seek.webm", function (arrayBuffer) { > sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 318)); > - once(v, "loadedmetadata") > + var promises = []; > + promises.push(once(sb, "updateend")); Per spec, we expect 'updateend' to come after 'loadedmetadata', right?
Attachment #8871949 - Flags: review?(jwwang) → review+
Attachment #8871950 - Flags: review?(jwwang) → review+
Comment on attachment 8871949 [details] Bug 1362165: P8. Fix mochitests. https://reviewboard.mozilla.org/r/143468/#review147374 > Per spec, we expect 'updateend' to come after 'loadedmetadata', right? yes... however the order set in promises do no matter. but I'll change the order to make it clearer
Attachment #8871951 - Flags: review?(james) → review?(jwwang)
Attachment #8871952 - Flags: review?(james) → review?(jwwang)
Attachment #8871951 - Flags: review?(james) → review?(jwwang)
Attachment #8871952 - Flags: review?(james) → review?(jwwang)
Comment on attachment 8871952 [details] Bug 1362165: Correct test. https://reviewboard.mozilla.org/r/143474/#review147750 r+ with nit: ::: commit-message-51d93:6 (Diff revision 2) > +Bug 1362165: Correct test. r?jgraham > + > +the durationchange event will be queued during the initialization segment received algorithm. > +Only once the init segment has been fully processed will update/updateend be queued. > + > +As such, the updateend event must be fired before being able to call appendBuffer once again. Remove 2nd space in "to call".
Attachment #8871952 - Flags: review+
Pushed by jyavenard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/20e01cb7989d P1. Fix potential race accessing members. r=gerald https://hg.mozilla.org/integration/autoland/rev/c89c6c8630f1 P2. Don't expect that all data has been processed after metadata. r=gerald https://hg.mozilla.org/integration/autoland/rev/bc1e56d5cb9b P3. Remove unecessary code. r=gerald https://hg.mozilla.org/integration/autoland/rev/5334cc6d0ea9 P4. Don't assume the duration found when reading metadata will be the final one. r=gerald https://hg.mozilla.org/integration/autoland/rev/bb63055aef6c P5. Don't assume that when stalling all data has been loaded. r=gerald https://hg.mozilla.org/integration/autoland/rev/55f7558b7c52 P6. Only use sourcebuffer again once previous operation completed. r=gerald https://hg.mozilla.org/integration/autoland/rev/846a4761d0cd P7. Only complete appendBuffer once readyState has changed. r=jwwang https://hg.mozilla.org/integration/autoland/rev/be4b872ba909 P8. Fix mochitests. r=jwwang https://hg.mozilla.org/integration/autoland/rev/2ba56b296e40 P9. Update mochitests. r=jwwang https://hg.mozilla.org/integration/autoland/rev/3329385fcf2d Add web platform test. r=gerald https://hg.mozilla.org/integration/autoland/rev/138425350cc6 Correct test. r=gerald https://hg.mozilla.org/integration/autoland/rev/1e51fbdefff8 P12. Updated wpt expectation. r=gerald
Blocks: 1403478
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: