Commit ae6cd18
committed
Add support for ImageCapture.grabFrame
rdar://148425176
https://bugs.webkit.org/show_bug.cgi?id=290916
Reviewed by Eric Carlson.
Add support of ImageCapture::grabFrame by doing the following:
- Introduce ImageCaptureVideoFrameObserver as a VideoFrameObserver on the ImageCapture track.
- Convert the VideoFrame into an ImageBitmap. We handle the rotation so that drawing the ImageBitmap is similar to rendering the track via a media element.
- The conversion requires conversion to RGB which is done in GPUProcess. For that purpose, we introduce a new MediaStrategy which uses an existing IPC call.
Marking as failing in glib since there is a lack of mock rotation support.
Covered by added test.
* LayoutTests/fast/mediastream/image-capture-grabFrame-expected.txt: Added.
* LayoutTests/fast/mediastream/image-capture-grabFrame.html: Added.
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/Modules/mediastream/ImageCapture.cpp:
(WebCore::ImageCapture::~ImageCapture):
(WebCore::videoFrameOrientation):
(WebCore::createImageBitmapViaDrawing):
(WebCore::createImageBitmapFromNativeImage):
(WebCore::createImageBitmap):
(WebCore::ImageCaptureVideoFrameObserver::create):
(WebCore::ImageCaptureVideoFrameObserver::~ImageCaptureVideoFrameObserver):
(WebCore::ImageCaptureVideoFrameObserver::add):
(WebCore::ImageCaptureVideoFrameObserver::stop):
(WebCore::ImageCaptureVideoFrameObserver::ImageCaptureVideoFrameObserver):
(WebCore::ImageCaptureVideoFrameObserver::processVideoFrame):
(WebCore::ImageCapture::grabFrame):
(WebCore::ImageCapture::stop):
(WebCore::ImageCapture::stopGrabFrameObserver):
* Source/WebCore/Modules/mediastream/ImageCapture.h:
* Source/WebCore/Modules/mediastream/ImageCapture.idl:
* Source/WebCore/platform/MediaStrategy.h:
(WebCore::MediaStrategy::nativeImageFromVideoFrame):
* Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::orientationChanged):
* Source/WebKit/WebProcess/GPU/media/WebMediaStrategy.cpp:
(WebKit::WebMediaStrategy::nativeImageFromVideoFrame):
* Source/WebKit/WebProcess/GPU/media/WebMediaStrategy.h:
Canonical link: https://commits.webkit.org/293243@main1 parent e7b2eb3 commit ae6cd18
File tree
10 files changed
+415
-2
lines changed- LayoutTests
- fast/mediastream
- platform/glib
- Source
- WebCore
- Modules/mediastream
- platform
- mock
- WebKit/WebProcess/GPU/media
10 files changed
+415
-2
lines changedLines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 167 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2235 | 2235 | | |
2236 | 2236 | | |
2237 | 2237 | | |
| 2238 | + | |
2238 | 2239 | | |
2239 | 2240 | | |
2240 | 2241 | | |
| |||
0 commit comments