RESOLVED FIXED Bug 201422
REGRESSION(r249428): [GStreamer] VP9 video rendered green
https://bugs.webkit.org/show_bug.cgi?id=201422
Summary REGRESSION(r249428): [GStreamer] VP9 video rendered green
Philippe Normand
Reported 2019-09-03 08:26:48 PDT
VP9 videos available on Youtube TV are rendered in opaque green. vp9dec is the video decoder used. H.264 playback is OK though.
Attachments
Patch (2.00 KB, patch)
2019-09-06 04:07 PDT, Chris Lord
no flags
Patch (5.88 KB, patch)
2019-10-03 06:08 PDT, Thibault Saunier
no flags
Patch (5.52 KB, patch)
2019-10-06 06:30 PDT, Alicia Boya García
no flags
Patch (2.47 KB, patch)
2019-10-28 02:52 PDT, Philippe Normand
no flags
Patch (2.75 KB, patch)
2019-10-30 06:16 PDT, Philippe Normand
no flags
Patch (3.88 KB, patch)
2019-11-05 09:39 PST, Philippe Normand
no flags
Archive of layout-test-results from webkit-cq-01 for mac-highsierra (3.64 MB, application/zip)
2019-11-06 01:20 PST, WebKit Commit Bot
no flags
Patch (4.31 KB, patch)
2019-11-18 10:28 PST, Thibault Saunier
no flags
Patch (4.36 KB, patch)
2019-11-18 10:43 PST, Thibault Saunier
no flags
Patch for landing (4.45 KB, patch)
2019-11-19 03:50 PST, Thibault Saunier
no flags
Patch for landing (4.45 KB, patch)
2019-11-19 03:56 PST, Thibault Saunier
no flags
Chris Lord
Comment 1 2019-09-06 04:07:17 PDT
Philippe Normand
Comment 2 2019-09-06 08:23:37 PDT
Comment on attachment 378181 [details] Patch I confirm this approach works but I would prefer, if possible, to make glupload behave the same for all video formats. For vp9 the "Raw Data" uploader is selected, I suspect this is related with the issue at hand. For h264 the GLMemory uploader is selected and that works well. So I would like to understand why the glupload behavior differs.
Chris Lord
Comment 3 2019-09-09 03:32:55 PDT
Good call on r-'ing this, it seems to cause problems while seeking videos. Philippe's investigation shows that the failing vp9 videos are hitting the rawdata upload path rather than the glupload path, due to a buffer number mismatch. My theory was that this sync would be necessary anyway, as what's possibly happening is that we're missing a sync point when videos hit the passthrough path on glcolorconvert and the only reason it seems to be working is that because the glupload path uses a buffer pool, we get to see old frames without syncing. While I'm still not uncertain about the sync being necessary, testing shows that seeking videos with this patch can (easily) cause deadlock. Without this patch, the video display goes blank (as I suspected it might), so there may be an issue here. It looks like the synchronisation is necessary, but our current method isn't quite right.
Víctor M. Jáquez L.
Comment 4 2019-09-17 05:32:23 PDT
Comment on attachment 378181 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=378181&action=review > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1215 > + gst_caps_set_features(caps.get(), 0, gst_caps_features_new(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, nullptr)); It is better to avoid the use of GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META since it is going to be deprecated soon.
Chris Lord
Comment 5 2019-09-17 06:59:39 PDT
(In reply to Víctor M. Jáquez L. from comment #4) > Comment on attachment 378181 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=378181&action=review > > > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1215 > > + gst_caps_set_features(caps.get(), 0, gst_caps_features_new(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, nullptr)); > > It is better to avoid the use of > GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META since it is going to > be deprecated soon. Yes, I realise it doesn't really do what I thought it did. We essentially debugged far enough to settle on the idea that this bug is caused by a quirk of behaviour in the vpx decoder that means a different upload path is taken, one which doesn't provide sync meta. I've put it on hold to work on OffscreenCanvas for now, but my last thought for a work-around was to detect when there's no sync meta and use a locally allocated GStreamer buffer pool with the sync meta flag set and copy the buffer over. This is essentially what makes things work when they go through glcolorconvert (and even copying it, though not ideal, is still marginally less work than forcing an unnecessary colour conversion). I have most of the code lying around to try this out and once OffscreenCanvas work has gotten to a better stopping point, I'll try to write a new patch to fix this. Meanwhile, using gst-plugins-libav for vp9 decoding doesn't present this issue.
Philippe Normand
Comment 6 2019-09-18 08:27:38 PDT
I think this would need to be solved: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/209 With a GL buffer pool in the "Raw Data" uploader it would be trivial to handle the GL sync meta.
Chris Lord
Comment 7 2019-09-18 08:33:11 PDT
(In reply to Philippe Normand from comment #6) > I think this would need to be solved: > > https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/209 > > With a GL buffer pool in the "Raw Data" uploader it would be trivial to > handle the GL sync meta. Agreed (on the GStreamer side though, I assume you mean). I'm happy to pass the buck to GStreamer on this one and not have any unnecessary work-around code in WebKit :)
Philippe Normand
Comment 8 2019-09-18 18:11:42 PDT
Yes I meant this is a pure-GStreamer issue, no workaround should be needed in WebKit, IMHO :)
Philippe Normand
Comment 9 2019-10-03 04:56:36 PDT
This was fixed in gst-plugins-base: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/commit/8d32de090554cf29fe359f83aa46000ba658a693 Can we have that patch in our JHBuild?
Thibault Saunier
Comment 10 2019-10-03 06:08:24 PDT
Philippe Normand
Comment 11 2019-10-03 06:15:51 PDT
Comment on attachment 380103 [details] Patch Thanks :)
WebKit Commit Bot
Comment 12 2019-10-03 07:00:53 PDT
Comment on attachment 380103 [details] Patch Clearing flags on attachment: 380103 Committed r250652: <https://trac.webkit.org/changeset/250652>
WebKit Commit Bot
Comment 13 2019-10-03 07:00:55 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 14 2019-10-03 07:02:18 PDT
Alicia Boya García
Comment 15 2019-10-06 06:30:45 PDT
Reopening to attach new patch.
Alicia Boya García
Comment 16 2019-10-06 06:30:48 PDT
Alicia Boya García
Comment 17 2019-10-06 06:34:25 PDT
Oops. Collision. :)
Charlie Turner
Comment 18 2019-10-26 18:11:58 PDT
*** Bug 203459 has been marked as a duplicate of this bug. ***
Charlie Turner
Comment 19 2019-10-26 18:12:40 PDT
This should be backported to our release branches, since it's affecting users of the ephy tech preview.
Michael Catanzaro
Comment 20 2019-10-27 06:15:03 PDT
No, the bug doesn't occur in 2.26.1. It only occurs with 2.27.2. Reopening since 2.27.2 is much newer than this fix.
Michael Catanzaro
Comment 21 2019-10-27 06:20:43 PDT
Ah, I see the patch only touches the JHBuild moduleset (and so will have no effect on releases). Looks like the code in 2.27.2 depends on GStreamer 1.16.2 to function properly? I will hold Tech Preview to 2.26 until that is released, then. It's unfortunate to effectively add a new dependency on unreleased GStreamer, especially for LTS distros. Without knowing the technical details behind whatever changed in WebKit since 2.26, I assume you would avoid that if possible.
Charlie Turner
Comment 22 2019-10-27 23:38:19 PDT
Yes, by release branches I was of course referring to GStreamer, whether we can get it back into the LTS verions of GStreamer remains to be seen. You assume correctly!
Philippe Normand
Comment 23 2019-10-28 02:52:39 PDT
Reopening to attach new patch.
Philippe Normand
Comment 24 2019-10-28 02:52:42 PDT
Thibault Saunier
Comment 25 2019-10-28 03:45:33 PDT
Comment on attachment 382056 [details] Patch Informal r+
Carlos Garcia Campos
Comment 26 2019-10-28 05:01:33 PDT
Comment on attachment 382056 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382056&action=review Currently building with the patch, I'll let you know when it finishes. > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1208 > + // Workaround until GStreamer 1.16.2 shipping > + // https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/commit/8d32de090554cf29fe359f83aa46000ba658a693 > + // is released. See also https://bugs.webkit.org/show_bug.cgi?id=201422 We won't be able to remove this even when 1.16.2 is released, because we don't depend on gst 1.16.2. > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1210 > + gst_caps_features_add(features, GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META); Could you explain in the comment why adding GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META?
Philippe Normand
Comment 27 2019-10-30 06:16:26 PDT
WebKit Commit Bot
Comment 28 2019-10-30 07:14:18 PDT
The commit-queue encountered the following flaky tests while processing attachment 382300 [details]: imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-double-submit-3.html bug 203609 (author: cdumez@apple.com) The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 29 2019-10-30 07:15:06 PDT
Comment on attachment 382300 [details] Patch Clearing flags on attachment: 382300 Committed r251772: <https://trac.webkit.org/changeset/251772>
WebKit Commit Bot
Comment 30 2019-10-30 07:15:08 PDT
All reviewed patches have been landed. Closing bug.
Miguel Gomez
Comment 31 2019-10-31 05:01:20 PDT
Reverted r251772 for reason: Caused lots of media related tests to timeout Committed r251838: <https://trac.webkit.org/changeset/251838>
Carlos Garcia Campos
Comment 32 2019-10-31 07:39:48 PDT
Maybe we also need to remove the gst patch?
Philippe Normand
Comment 33 2019-11-05 08:19:36 PST
Comment on attachment 382300 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=382300&action=review > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1214 > + gst_caps_features_add(features, GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META); Actually this doesn't work because glupload doesn't accept the texture upload and the gl-mem caps features simultaneously. So caps negotiation is failure prone here. I have another patch proposal...
Philippe Normand
Comment 34 2019-11-05 09:39:03 PST
WebKit Commit Bot
Comment 35 2019-11-06 01:20:47 PST
Comment on attachment 382829 [details] Patch Rejecting attachment 382829 [details] from commit-queue. New failing tests: webgl/1.0.3/conformance/extensions/webgl-draw-buffers.html Full output: https://webkit-queues.webkit.org/results/13218193
WebKit Commit Bot
Comment 36 2019-11-06 01:20:50 PST
Created attachment 382904 [details] Archive of layout-test-results from webkit-cq-01 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the commit-queue. Bot: webkit-cq-01 Port: mac-highsierra Platform: Mac OS X 10.13.6
Carlos Garcia Campos
Comment 37 2019-11-06 01:39:08 PST
Thibault Saunier
Comment 38 2019-11-18 10:28:04 PST
Reopening to attach new patch.
Thibault Saunier
Comment 39 2019-11-18 10:28:07 PST
Thibault Saunier
Comment 40 2019-11-18 10:43:19 PST
Carlos Garcia Campos
Comment 41 2019-11-19 01:00:08 PST
Comment on attachment 383761 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=383761&action=review > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1215 > + GRefPtr<GstCaps> caps = nullptr; No need to initialize to nullptr, the constructor already initializes the pointer.
Philippe Normand
Comment 42 2019-11-19 01:56:30 PST
Comment on attachment 383761 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=383761&action=review > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1218 > if (webkitGstCheckVersion(1, 16, 2) || getenv("WEBKIT_GST_NO_RGBA_CONVERSION")) { > - GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(upload, "sink")); > - gst_element_add_pad(videoSink, gst_ghost_pad_new("sink", pad.get())); > + caps = adoptGRef(gst_caps_from_string("video/x-raw, format = (string) " GST_GL_CAPS_FORMAT)); > } else { {} can be removed because this is a one-line block now.
Thibault Saunier
Comment 43 2019-11-19 03:50:42 PST
Created attachment 383857 [details] Patch for landing
WebKit Commit Bot
Comment 44 2019-11-19 03:51:43 PST
Comment on attachment 383857 [details] Patch for landing Rejecting attachment 383857 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 383857, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in Source/WebCore/ChangeLog contains OOPS!. Full output: https://webkit-queues.webkit.org/results/13266584
Thibault Saunier
Comment 45 2019-11-19 03:56:40 PST
Created attachment 383859 [details] Patch for landing
WebKit Commit Bot
Comment 46 2019-11-19 04:41:33 PST
Comment on attachment 383859 [details] Patch for landing Clearing flags on attachment: 383859 Committed r252624: <https://trac.webkit.org/changeset/252624>
WebKit Commit Bot
Comment 47 2019-11-19 04:41:35 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.