Created attachment 462314 [details]
Test case to reproduce the missing holepunch after changing video source
Since r295749 (251754@main), the holepunch feature is broken (missing) after changing the video source.
See https://bugs.webkit.org/show_bug.cgi?id=240283 for the crash fix which causes this regression.
This bug can be seen with YouTube TV, just after skipping an ad.
The holepunch contents layer is reset to NULL after changing the source, which causes the holepunch buffer not to be rendered anymore.
The new content layer from the new MediaPlayer is set from TextureMapperPlatformLayerProxyGL::activateOnCompositingThread(), but after that, TextureMapperPlatformLayerProxyGL::invalidate() is called to invalidate the old content layer from the old MediaPlayer.
This sets the content layer to NULL in the target layer, and this disables the new content layer.
This can be reproduced on a WPE build with USE_GSTREAMER_HOLEPUNCH=ON and the attached test page.
Created attachment 462353 [details]
The issue is quite complicated to reproduce in my system. I was able to see it only once in tens of executions. This is because it has to happen that the old player is destroyed and the new one created before there's a layerFlush, so the CoordinatedGraphicsScene can be in the situation where a layer's proxy is replaced with a new one. Most of the times there's a layerFlush between the destruction of the old player and the creation of the new one, so the problem doesn't reproduce.
Anyway, I think the fix is as simple as doing the invalidation of the old proxies before activating the new ones.
Olivier, as you seem to be able to reproduce the issue reliably, could you give a test to this patch and check whether it fixes the problem?
Miguel: thank you, this fixes the issue for me.
I could reproduce the issue on my laptop, but it has been first detected on set-top boxes with less powerful CPUs.
Pull request: https://github.com/WebKit/WebKit/pull/4379
Committed 254548@main (f994a1b3e3dc): <https://commits.webkit.org/254548@main>
Reviewed commits have been landed. Closing PR #4379 and removing active labels.