pipewiresrc: do not active pool or allocator queried from downstream

This commit is contained in:
Elliot Chen 2025-07-14 11:52:22 +09:00
parent f073a1a59b
commit ff132aac54

View file

@ -117,6 +117,8 @@ static gboolean gst_pipewire_src_event (GstBaseSrc * src, GstEvent * event);
static gboolean gst_pipewire_src_query (GstBaseSrc * src, GstQuery * query);
static void gst_pipewire_src_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end);
static gboolean gst_pipewire_src_decide_allocation (GstBaseSrc * basesrc,
GstQuery * query);
static void
gst_pipewire_src_set_property (GObject * object, guint prop_id,
@ -501,6 +503,7 @@ gst_pipewire_src_class_init (GstPipeWireSrcClass * klass)
gstbasesrc_class->event = gst_pipewire_src_event;
gstbasesrc_class->query = gst_pipewire_src_query;
gstbasesrc_class->get_times = gst_pipewire_src_get_times;
gstbasesrc_class->decide_allocation = gst_pipewire_src_decide_allocation;
gstpushsrc_class->create = gst_pipewire_src_create;
GST_DEBUG_CATEGORY_INIT (pipewire_src_debug, "pipewiresrc", 0,
@ -1522,6 +1525,30 @@ gst_pipewire_src_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
GST_TIME_ARGS (*start), *start, GST_TIME_ARGS (*end), *end);
}
static gboolean
gst_pipewire_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query)
{
guint i;
/* pipewirsrc has own buffer pool. Clear the allocation information
* which is query from downstream to prevent from activing pool or
* allocator by base class.
*/
for (i = 0; i < gst_query_get_n_allocation_pools (query); i++) {
gst_query_remove_nth_allocation_pool (query, i);
}
for (i = 0; i < gst_query_get_n_allocation_params (query); i++) {
gst_query_remove_nth_allocation_param (query, i);
}
for (i = 0; i < gst_query_get_n_allocation_metas (query); i++) {
gst_query_remove_nth_allocation_meta (query, i);
}
return TRUE;
}
static GstFlowReturn
gst_pipewire_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
{