diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 934b3dbe53..342f1a50f5 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -551,9 +551,9 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config) | GST_V4L2_ALLOCATOR_FLAG_DMABUF_CREATE_BUFS); } - if (min_buffers < GST_V4L2_MIN_BUFFERS) { + if (min_buffers < GST_V4L2_MIN_BUFFERS (obj)) { updated = TRUE; - min_buffers = GST_V4L2_MIN_BUFFERS; + min_buffers = GST_V4L2_MIN_BUFFERS (obj); GST_INFO_OBJECT (pool, "increasing minimum buffers to %u", min_buffers); } @@ -766,7 +766,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool) &max_buffers)) goto wrong_config; - min_latency = MAX (GST_V4L2_MIN_BUFFERS, obj->min_buffers); + min_latency = MAX (GST_V4L2_MIN_BUFFERS (obj), obj->min_buffers); switch (obj->mode) { case GST_V4L2_IO_RW: @@ -795,7 +795,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool) V4L2_MEMORY_MMAP); pool->num_allocated = count; - if (count < GST_V4L2_MIN_BUFFERS) { + if (count < GST_V4L2_MIN_BUFFERS (obj)) { min_buffers = count; goto no_buffers; } @@ -908,7 +908,7 @@ no_buffers: { GST_ERROR_OBJECT (pool, "we received %d buffer from device '%s', we want at least %d", - min_buffers, obj->videodev, GST_V4L2_MIN_BUFFERS); + min_buffers, obj->videodev, GST_V4L2_MIN_BUFFERS (obj)); gst_structure_free (config); return FALSE; } diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 63eebe7042..8b4169e4e0 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -4701,12 +4701,12 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query) /* In this case we'll have to configure two buffer pool. For our buffer * pool, we'll need what the driver one, and one more, so we can dequeu */ own_min = obj->min_buffers + 1; - own_min = MAX (own_min, GST_V4L2_MIN_BUFFERS); + own_min = MAX (own_min, GST_V4L2_MIN_BUFFERS (obj)); /* for the downstream pool, we keep what downstream wants, though ensure * at least a minimum if downstream didn't suggest anything (we are * expecting the base class to create a default one for the context) */ - min = MAX (min, GST_V4L2_MIN_BUFFERS); + min = MAX (min, GST_V4L2_MIN_BUFFERS (obj)); /* To import we need the other pool to hold at least own_min */ if (obj->pool == pool) @@ -4844,7 +4844,7 @@ gst_v4l2_object_propose_allocation (GstV4l2Object * obj, GstQuery * query) /* Set defaults allocation parameters */ size = obj->info.size; - min = GST_V4L2_MIN_BUFFERS; + min = GST_V4L2_MIN_BUFFERS (obj); max = VIDEO_MAX_FRAME; gst_query_parse_allocation (query, &caps, &need_pool); @@ -4882,7 +4882,7 @@ gst_v4l2_object_propose_allocation (GstV4l2Object * obj, GstQuery * query) } gst_v4l2_get_driver_min_buffers (obj); - min = MAX (obj->min_buffers, GST_V4L2_MIN_BUFFERS); + min = MAX (obj->min_buffers, GST_V4L2_MIN_BUFFERS (obj)); gst_query_add_allocation_pool (query, pool, size, min, max); diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h index 0c127e11d6..d5cd83d303 100644 --- a/sys/v4l2/gstv4l2object.h +++ b/sys/v4l2/gstv4l2object.h @@ -43,7 +43,7 @@ typedef struct _GstV4l2ObjectClassHelper GstV4l2ObjectClassHelper; #include /* size of v4l2 buffer pool in streaming case */ -#define GST_V4L2_MIN_BUFFERS 2 +#define GST_V4L2_MIN_BUFFERS(obj) 2 /* max frame width/height */ #define GST_V4L2_MAX_SIZE (1<<15) /* 2^15 == 32768 */ diff --git a/sys/v4l2/gstv4l2transform.c b/sys/v4l2/gstv4l2transform.c index d2a2cf3133..f5e4d796bd 100644 --- a/sys/v4l2/gstv4l2transform.c +++ b/sys/v4l2/gstv4l2transform.c @@ -893,7 +893,8 @@ gst_v4l2_transform_prepare_output_buffer (GstBaseTransform * trans, /* Ensure input internal pool is active */ if (!gst_buffer_pool_is_active (pool)) { GstStructure *config = gst_buffer_pool_get_config (pool); - gint min = MAX (GST_V4L2_MIN_BUFFERS, self->v4l2output->min_buffers); + gint min = MAX (GST_V4L2_MIN_BUFFERS (self->v4l2output), + self->v4l2output->min_buffers); if (self->v4l2output->mode == GST_V4L2_IO_USERPTR || self->v4l2output->mode == GST_V4L2_IO_DMABUF_IMPORT) { diff --git a/sys/v4l2/gstv4l2videoenc.c b/sys/v4l2/gstv4l2videoenc.c index 36e1515adc..d1421dab5e 100644 --- a/sys/v4l2/gstv4l2videoenc.c +++ b/sys/v4l2/gstv4l2videoenc.c @@ -739,7 +739,8 @@ gst_v4l2_video_enc_handle_frame (GstVideoEncoder * encoder, /* Ensure input internal pool is active */ if (!gst_buffer_pool_is_active (pool)) { GstStructure *config = gst_buffer_pool_get_config (pool); - guint min = MAX (self->v4l2output->min_buffers, GST_V4L2_MIN_BUFFERS); + guint min = MAX (self->v4l2output->min_buffers, + GST_V4L2_MIN_BUFFERS (self->v4l2output)); gst_buffer_pool_config_set_params (config, self->input_state->caps, self->v4l2output->info.size, min, min);