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

No handling for when the MediaSource constructed in a DedicatedWorkerGlobalScope goes out of scope #348

Open
jyavenard opened this issue Feb 18, 2024 · 0 comments

Comments

@jyavenard
Copy link
Member

The current "Detaching from a media element" [1] handles the case where the media element is being removed or unusable (transitioned to NETWORK_EMPTY).

Such definition is sufficient when the MediaSource wasn't constructed in a DedicatedWorkerGlobakScope, but otherwise isn't the case.

a MediaSource constructed in a worker can be deleted at any time, such as when the DedicatedWorkerGlobalScope itself goes out of scope.

The steps on what should happen to the HTMLMediaElement remain undefined.

[1] https://w3c.github.io/media-source/#mediasource-detach

webkit-commit-queue pushed a commit to jyavenard/WebKit that referenced this issue Feb 19, 2024
https://bugs.webkit.org/show_bug.cgi?id=269564
rdar://123076441

Reviewed by Eric Carlson.

Import WPT media-source/dedicated-worker.

Somes changes were required to make all tests pass.
1- When the MediaSource in the worker is being deleted, clean up its SourceBufferLists
and notify the HTMLMediaElement about it. The steps added aren't defined in the MSE spec.
Issue was raised as w3c/media-source#348
2- TrackBase's creation of the nullLogger wasn't thread-safe and could have been
concurrently accessed from both the main and worker thread.
3- Using a MediaSourceHandle already detached or previously attached to a media
element must fail
4- The [[has ever been attached]] slot is to be set to true prior changing the
delaying the load flag to false

media-source/dedicated-worker/mediasource-worker-play.html times out but so does chrome. Will investigate in
a follow-up post.

Upstream commit: web-platform-tests/wpt@32864fa

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-message-util.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-detach-element-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-detach-element.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-detach-element.js: Added.
(onmessage):
(catch):
(sourceBuffer.onerror):
(postMessage):
(bufferInto):
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-duration-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-duration.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-duration.js: Added.
(processPhase):
(checkAckVerificationData.messageValuesEqual):
(checkAckVerificationData):
(bufferMediaAndSendDurationVerificationRequest):
(assert):
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-get-objecturl.js: Added.
(onmessage):
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-handle-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-handle-transfer-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-handle-transfer-to-main.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-handle-transfer.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-handle-transfer.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-handle.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-handle.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-must-fail-if-unsupported.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-objecturl-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-objecturl.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-objecturl.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-play-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-play-terminate-worker-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-play-terminate-worker.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-play-terminate-worker.js: Added.
(catch):
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-play.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-play.js: Added.
(onmessage):
(catch):
(sourceBuffer.onerror):
(sourceBuffer.onupdateend):
(postMessage):
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-util.js: Added.
(MediaSourceWorkerUtil):
(MediaSourceWorkerUtil.loadBinaryAsync):
* LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/w3c-import.log: Added.
* LayoutTests/platform/mac-wk2/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::~MediaSource):
(WebCore::MediaSource::setPrivateAndOpen):
(WebCore::MediaSource::attachToElement):
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::mediaSourceWasDetached):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/track/TrackBase.cpp:
(WebCore::nullLogger):
(WebCore::TrackBase::TrackBase):

Canonical link: https://commits.webkit.org/274959@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant