gst: pool: Some refinements to min/max handling

A number of changes for correctness.

  1) We expose the actualy min and max values we support in the
     allocation query.

  2) We don't support max_buffers as 0, as unlimited buffers is not an
     option

  3) In ParamBuffers, we request the max_buffers from bufferpool config,
     as we cannot dynamically allocate buffers
This commit is contained in:
Arun Raghavan 2025-03-26 11:55:13 -04:00
parent 5ef13489db
commit d7cb68bfc7
3 changed files with 24 additions and 6 deletions

View file

@ -255,6 +255,16 @@ set_config (GstBufferPool * pool, GstStructure * config)
return FALSE;
}
/* We don't support unlimited buffers */
if (max_buffers == 0)
max_buffers = PIPEWIRE_POOL_MAX_BUFFERS;
/* Pick a sensible min to avoid starvation */
if (min_buffers == 0)
min_buffers = PIPEWIRE_POOL_MIN_BUFFERS;
if (min_buffers < PIPEWIRE_POOL_MIN_BUFFERS || max_buffers > PIPEWIRE_POOL_MAX_BUFFERS)
return FALSE;
structure = gst_caps_get_structure (caps, 0);
if (g_str_has_prefix (gst_structure_get_name (structure), "video/") ||
g_str_has_prefix (gst_structure_get_name (structure), "image/")) {