Bug 235600

Summary: Capturing WebGL canvas through peer connection shows the image flipped
Product: WebKit Reporter: Kimmo Kinnunen <kkinnunen>
Component: WebGLAssignee: Kimmo Kinnunen <kkinnunen>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, eric.carlson, ews-watchlist, glenn, hta, jer.noble, kbr, kkinnunen, kondapallykalyan, philipj, sergio, tommyw, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=230613
https://bugs.webkit.org/show_bug.cgi?id=235708
https://bugs.webkit.org/show_bug.cgi?id=235765
Bug Depends on:    
Bug Blocks: 232727    
Attachments:
Description Flags
WIP
ews-feeder: commit-queue-
Patch
none
Simpler version
none
Simpler version
none
For debugging
none
Patch
none
Patch
none
Patch none

Kimmo Kinnunen
Reported 2022-01-25 10:43:56 PST
Capturing WebGL canvas through peer connection shows the image flipped
Attachments
WIP (41.98 KB, patch)
2022-01-26 10:29 PST, Kimmo Kinnunen
ews-feeder: commit-queue-
Patch (43.83 KB, patch)
2022-01-26 11:26 PST, Kimmo Kinnunen
no flags
Simpler version (20.43 KB, patch)
2022-01-27 00:18 PST, Kimmo Kinnunen
no flags
Simpler version (20.43 KB, patch)
2022-01-27 00:43 PST, Kimmo Kinnunen
no flags
For debugging (20.73 KB, patch)
2022-01-27 04:16 PST, Kimmo Kinnunen
no flags
Patch (20.60 KB, patch)
2022-01-27 05:53 PST, Kimmo Kinnunen
no flags
Patch (21.60 KB, patch)
2022-01-28 05:11 PST, Kimmo Kinnunen
no flags
Patch (21.60 KB, patch)
2022-01-28 06:28 PST, Kimmo Kinnunen
no flags
Radar WebKit Bug Importer
Comment 1 2022-01-25 14:04:05 PST
Kimmo Kinnunen
Comment 2 2022-01-26 09:11:43 PST
https://youennf.github.io/webrtc-tests/src/content/capture/canvas-pc/ <-- shows the bug Note: The newer version of this fails to show anything: https://webrtc.github.io/samples/src/content/capture/canvas-pc/ <-- does not show stuff
Kimmo Kinnunen
Comment 3 2022-01-26 09:14:52 PST
Youenn Fablet 7:12 PM canvas-pc is using legacy APIs that we do not support and it messes up the script. https://github.com/webrtc/samples/pull/1511
Kimmo Kinnunen
Comment 4 2022-01-26 10:29:51 PST
Kimmo Kinnunen
Comment 5 2022-01-26 11:26:54 PST
Dean Jackson
Comment 6 2022-01-26 14:03:18 PST
Comment on attachment 450043 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=450043&action=review > Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:556 > + // TODO: When this is moved to GraphicsContextGLCocoa, set m_mediaSampleRotationSession = nullptr. s/TODO/FIXME/ > LayoutTests/webrtc/canvas-to-peer-connection.html:80 > +// FIXME: Tthis should be filled when 2D context supports HTMLCanvasElement.captureStream(). Typo: Tthis
Kimmo Kinnunen
Comment 7 2022-01-27 00:18:16 PST
Created attachment 450107 [details] Simpler version
Kimmo Kinnunen
Comment 8 2022-01-27 00:43:44 PST
Created attachment 450112 [details] Simpler version
youenn fablet
Comment 9 2022-01-27 01:19:31 PST
Comment on attachment 450112 [details] Simpler version View in context: https://bugs.webkit.org/attachment.cgi?id=450112&action=review > Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:791 > + return MediaSampleAVFObjC::createImageSample(WTFMove(mediaSamplePixelBuffer), MediaSampleAVFObjC::VideoRotation::None, false); When canvas is in GPUProcess, aren't we going the RemoteGraphicsContextGLProxyCocoa::paintCompositedResultsToMediaSample code path? It seems that RemoteGraphicsContextGLCocoa::prepareForDisplay should somehow do the flip if needed to remove the need for RemoteGraphicsContextGLProxyCocoa::paintCompositedResultsToMediaSample to make the sample as upsidedown+flipped.
Kimmo Kinnunen
Comment 10 2022-01-27 04:16:55 PST
Created attachment 450124 [details] For debugging
Kimmo Kinnunen
Comment 11 2022-01-27 05:53:18 PST
Kimmo Kinnunen
Comment 12 2022-01-28 05:11:48 PST
Kimmo Kinnunen
Comment 13 2022-01-28 06:28:58 PST
EWS
Comment 14 2022-01-29 03:50:55 PST
Committed r288789 (246566@main): <https://commits.webkit.org/246566@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 450229 [details].
Note You need to log in before you can comment on or make changes to this bug.