alphacombine: Fix for early allocation queries
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 10 Dec 2021 20:18:56 +0000 (15:18 -0500)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 10 Dec 2021 21:37:14 +0000 (21:37 +0000)
commit2886eab3c462df82347fc3f518c62d6621d4e09e
tree71e25b967a7c656e8d3a864ed2308bccfeecff5a
parente0f8ce501bf57d4cf93e276d8ac539865ec9b409
alphacombine: Fix for early allocation queries

When using playbin3, it seems that the alpha decode is always first to
push caps and run an allocation query. As the format change from sink
and alpha were not synchronized, the allocation query could endup
being run before the caps are pushed. That may lead to failing query,
which makes the decoder thinks there is no GstVideoMeta downstream and
most likely CPU copy the frame.

This patch implements a format cookie to track and synchronize the
format changes on both pads fixing the racy performance issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1439>
subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c