| Summary: | Media recorder produces empty chunks | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Jozef <32jojo32> | ||||
| Component: | Canvas | Assignee: | youenn fablet <youennf> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | dino, eric.carlson, jer.noble, webkit-bug-importer, youennf | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari 16 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
I reproduced the issue. The difference seems to be that HTMLDocument is made observer of the canvas when it works and not when it works. It follows that Document::canvasChanged is called which triggers preparation of canvas, which triggers a video frame in the stream. In the failing case, CanvasCaptureMediaStreamTrack::Source::canvasChanged returns early because the rendering context needsPreparationForDisplay returns true. But the document is not observing the canvas so ends up not triggering the code path of HTMLCanvasElement::prepareForDisplay. Pull request: https://github.com/WebKit/WebKit/pull/14236 Committed 264478@main (712b8a916d0d): <https://commits.webkit.org/264478@main> Reviewed commits have been landed. Closing PR #14236 and removing active labels. |
Created attachment 466413 [details] canvas-bug-mwe When attaching MediaStream before context in canvas is created then MediaRecorder produces only empty chunks. Steps to replicate: 1. Open the provided html file 2. Click the button 3. You will see only empty chunks in console 4. Uncomment the line #14 and comment code on line #17 5. Click the button again 6. You will see one non-empty chunk in console