alphacombine: Add missing query handler for gaps
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 25 Oct 2022 12:14:18 +0000 (08:14 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 26 Oct 2022 14:51:40 +0000 (14:51 +0000)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3264>

subprojects/gst-plugins-bad/gst/codecalpha/gstalphacombine.c

index d9149f7..2f47191 100644 (file)
@@ -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;