Skip to content

Commit

Permalink
[GTK] Video alpha channel doesn't work
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=233955

Reviewed by Miguel Gomez.

Set the ShouldBlend and ShouldPremultiply flags for the texture mapper when
pushing dma-buf video frames with alpha channel. This replicates what is done
for the GSTREAMER_GL code path in 238313@main.

Covered by media/video-with-alpha.html and manually tested with
https://zipdox.net/alphawebm/.

* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::pushDMABufToCompositor):

Canonical link: https://commits.webkit.org/276936@main
  • Loading branch information
cadubentzen authored and magomez committed Apr 2, 2024
1 parent fe7e1f6 commit aff02c3
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3437,6 +3437,10 @@ void MediaPlayerPrivateGStreamer::pushDMABufToCompositor()
}
}

auto textureMapperFlags = m_textureMapperFlags;
if (GST_VIDEO_INFO_HAS_ALPHA(&videoInfo))
textureMapperFlags.add({ TextureMapperFlags::ShouldBlend, TextureMapperFlags::ShouldPremultiply });

++m_sampleCount;

auto& proxy = m_nicosiaLayer->proxy();
Expand Down Expand Up @@ -3522,7 +3526,7 @@ void MediaPlayerPrivateGStreamer::pushDMABufToCompositor()
#endif
}
return WTFMove(object);
}, m_textureMapperFlags);
}, textureMapperFlags);

auto* quarkData = static_cast<DMABufMemoryQuarkData*>(gst_mini_object_get_qdata(GST_MINI_OBJECT_CAST(memory.get()), dmabuf_memory_quark()));
if (quarkData)
Expand Down Expand Up @@ -3615,7 +3619,7 @@ void MediaPlayerPrivateGStreamer::pushDMABufToCompositor()
auto object = swapchainBuffer->createDMABufObject(initialObject.handle);
object.colorSpace = colorSpaceForColorimetry(&GST_VIDEO_INFO_COLORIMETRY(&videoInfo));
return object;
}, m_textureMapperFlags);
}, textureMapperFlags);
}
#endif // USE(TEXTURE_MAPPER_DMABUF)

Expand Down

0 comments on commit aff02c3

Please sign in to comment.