From ea1dc750ae34dd19ebb399c45616c1ec291507a2 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 25 Oct 2022 08:14:18 -0400 Subject: [PATCH] alphacombine: Add missing query handler for gaps The gap handling was in place, but there was no event handler to trigger it. Implement the alpha sink event handler for the gaps. This fixes handling of valid streams which may not refresh the alpha frames for every video frames. It will also allow a clean error if the stream was missing the initial alpha frame, at least until we find a better way to handle these invalid frames. Related to #1518 Part-of: --- .../gst/codecalpha/gstalphacombine.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c b/subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c index d9149f7f89..2f47191eec 100644 --- a/subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c +++ b/subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c @@ -469,6 +469,14 @@ gst_alpha_combine_set_alpha_format (GstAlphaCombine * self, GstCaps * caps) return TRUE; } +static void +gst_alpha_combine_handle_gap (GstAlphaCombine * self) +{ + GstBuffer *gap_buffer = gst_buffer_new (); + GST_BUFFER_FLAG_SET (gap_buffer, GST_BUFFER_FLAG_GAP); + gst_alpha_combine_push_alpha_buffer (self, gap_buffer); +} + static gboolean gst_alpha_combine_sink_event (GstPad * pad, GstObject * object, GstEvent * event) @@ -519,6 +527,12 @@ gst_alpha_combine_alpha_event (GstPad * pad, GstObject * object, GstCaps *caps; gst_event_parse_caps (event, &caps); gst_alpha_combine_set_alpha_format (self, caps); + break; + } + case GST_EVENT_GAP: + { + gst_alpha_combine_handle_gap (self); + break; } default: break;