From 41ce99ebab3d2b4f9fbb4a4abcb78959a5c975c5 Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Tue, 10 Oct 2023 14:53:08 +0200 Subject: [PATCH] v4l2videoenc: fix activation of internal pool Fix the buffer pool activation if the driver does not support VIDIOC_CREATE_BUFS the same way as it was fixed for the v4l2videodec. Part-of: --- .../sys/v4l2/gstv4l2videoenc.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c index 5f1b38c772..f40d9790ac 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c @@ -793,9 +793,22 @@ gst_v4l2_video_enc_handle_frame (GstVideoEncoder * encoder, /* There is no reason to refuse this config */ if (!gst_buffer_pool_set_config (opool, config)) { - if (opool) - gst_object_unref (opool); - goto activate_failed; + config = gst_buffer_pool_get_config (opool); + + if (gst_buffer_pool_config_validate_params (config, + self->input_state->caps, self->v4l2output->info.size, min, + min)) { + gst_structure_free (config); + if (opool) + gst_object_unref (opool); + goto activate_failed; + } + + if (!gst_buffer_pool_set_config (opool, config)) { + if (opool) + gst_object_unref (opool); + goto activate_failed; + } } if (!gst_buffer_pool_set_active (opool, TRUE)) {