Bug 256695

Summary: WebRTC backed media element rendering is slow to update to changes of layers (size or layer made hidden/visible)
Product: WebKit Reporter: youenn fablet <youennf>
Component: Layout and RenderingAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, eric.carlson, jer.noble, ltsg0317, pvollan, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description youenn fablet 2023-05-12 04:29:44 PDT
WebRTC backed media element rendering is slow to update to changes of layers (size or layer made hidden/visible)
Comment 1 Radar WebKit Bug Importer 2023-05-12 04:30:04 PDT
<rdar://problem/109257177>
Comment 2 youenn fablet 2023-05-12 04:31:12 PDT
It takes sometimes more than one second for rendering to be updated.
I was able to see this with a recent Safari build on iOS when rotating devices (in which case the size of the video element may change).

I was also able to see this on macOS when setting a video track to enabled=false.
It takes sometimes more than one second to have the layer being hidden.
Comment 3 youenn fablet 2023-05-12 04:33:04 PDT
I wonder whether this is related to changes we did related to CARenderServer blocking.
Is there an easy way to unblock it and get back to the previous GPU based approach?
Comment 4 youenn fablet 2023-05-23 23:33:09 PDT
There are LocalSampleBufferDisplayLayer logs at the time we enqueue video frames in the AVSBDL.
It may take more than 5 seconds sometime to render the first video frame.
Comment 5 youenn fablet 2023-05-24 03:28:48 PDT
This is a regression from https://bugs.webkit.org/show_bug.cgi?id=253761.
Reverting https://commits.webkit.org/261709@main fixes the issue.

When the page is blank at camera starting time in macOS, CADebug tells us that the "LocalSampleBufferDisplayLayer AVSampleBufferDisplayLayer parent" size is (0, 0).
When the rendering is ok, the size is correctly set.

What is strange is that LocalSampleBufferDisplayLayer sets its CALayer bounds in a timely manner, but it does not seem to show up in CADebug.
At some point, rendering is updated, sometimes after 1 second, sometimes after 5 or more seconds.
Comment 6 youenn fablet 2023-05-31 04:28:21 PDT
Pull request: https://github.com/WebKit/WebKit/pull/14534
Comment 7 EWS 2023-05-31 22:58:08 PDT
Committed 264777@main (0e0d7976dfe0): <https://commits.webkit.org/264777@main>

Reviewed commits have been landed. Closing PR #14534 and removing active labels.
Comment 8 youenn fablet 2023-06-20 00:00:11 PDT
*** Bug 257885 has been marked as a duplicate of this bug. ***