Closed Bug 1774306 Opened 4 years ago Closed 3 years ago

Make VideoFrame Transferable

Categories

(Core :: Audio/Video: Web Codecs, task, P1)

task

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: chunmin, Assigned: chunmin)

References

(Blocks 1 open bug)

Details

Attachments

(6 external files, 1 obsolete file)

After VideoFrame is implemented (bug 1774300), we need to make it Transferable (in .webidl)

See Also: → 1562065

This patch implements Custom{Read, Write, Free}TransferHandler for
VideoFrame so VideoFrame can be transferred

Depends on D153686

Attachment #9289929 - Attachment description: WIP: Bug 1774306 - Implement [Transferable] for VideoFrame → Bug 1774306 - Implement [Transferable] for VideoFrame

Depends on D154677

Add a same-origin check to ensure transferring VideoFrame across
different agent cluster has doesn't work. Othewise, transferring
VideoFrame works when e10s is disabled.

Depends on D163194

Most of the member types in the data structure for [Serializable],
[Transferable], and FrameData are the same. They should be reused as
much as possible to lower the maintenance effort.

Depends on D163196

Attachment #9305539 - Attachment description: Bug 1774306 - Prevent VideoFrame from being transferred across different agent clusters → Bug 1774306 - Ensure VideoFrame is transferred within same origin

Depends on D163197

Blocks: 1805103
Blocks: 1805104
Pushed by cchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/51ee6beb36f8 Implement [Transferable] for VideoFrame r=smaug https://hg.mozilla.org/integration/autoland/rev/836597b2894b Add tests for [Transferable] VideoFrame r=smaug https://hg.mozilla.org/integration/autoland/rev/c2bae45b50fb Ensure VideoFrame is transferred within same origin r=smaug https://hg.mozilla.org/integration/autoland/rev/3b5616ad1231 Avoid manual JS Read/Writes in VideoFrame serialization r=padenot https://hg.mozilla.org/integration/autoland/rev/718fc08ac6a0 Simplify DS for [Serializable] and [Transferable] r=padenot https://hg.mozilla.org/integration/autoland/rev/aebaccb21fac Remove TODO comments r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/37491 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Attached file Bug 1774306 - Fix memory leak (obsolete) —

Without this patch, when the transferring-videoframe-across-origin test
(added in D163194) runs, StructuredCloneHolder leaks a VideoFrame in
CustomWriteTransferHandler since *aContent is set to a transferred
VideoFrame but neither CustomReadTransferHandler nor
CustomFreeTransferHandler is called to retrieve and release the
VideoFrame.

To avoid the memory leak, the transferred VideoFrame should be stored in
a member variable of the StructuredCloneHolder so it can be released in
StructuredCloneHolder's dtor even if no one takes the transferred
VideoFrame.

Depends on D163289

See Also: → 1806545
Depends on: 1807169

This turns out to be a bug in JSAutoStructuredCloneBuffer, which is badly mismanaging the ownership of the transferrable information. See bug 1807169.

The leak will be addressed in bug 1807169

Flags: needinfo?(cchang)
Attachment #9308747 - Attachment is obsolete: true
Pushed by cchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3e48a20bcf6c Implement [Transferable] for VideoFrame r=smaug https://hg.mozilla.org/integration/autoland/rev/667f252800dc Add tests for [Transferable] VideoFrame r=smaug https://hg.mozilla.org/integration/autoland/rev/d0c655f96db3 Ensure VideoFrame is transferred within same origin r=smaug https://hg.mozilla.org/integration/autoland/rev/cad7c78a17ea Avoid manual JS Read/Writes in VideoFrame serialization r=padenot https://hg.mozilla.org/integration/autoland/rev/57269c00c3d9 Simplify DS for [Serializable] and [Transferable] r=padenot https://hg.mozilla.org/integration/autoland/rev/c54aef18375d Remove TODO comments r=smaug
Upstream PR merged by moz-wptsync-bot
Regressions: 1815519
Component: Audio/Video → Audio/Video: Web Codecs
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: