From: Jeongmo Yang Date: Tue, 9 May 2023 05:04:58 +0000 (+0900) Subject: videoconvert: Fix prepare output buffer error X-Git-Tag: accepted/tizen/7.0/unified/20230511.022353~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e907abbd89cef16eaf8296ef80d71059c5bde33d;p=platform%2Fupstream%2Fgstreamer.git videoconvert: Fix prepare output buffer error - It's not considered that tizen buffer pool is not created. [Version] 1.20.0-47 [Issue Type] Bug fix Change-Id: I9bc6435ba35829cf52d4a96111caf7551172ccab Signed-off-by: Jeongmo Yang --- diff --git a/packaging/gstreamer.spec b/packaging/gstreamer.spec index da7faf01de..47cb643748 100644 --- a/packaging/gstreamer.spec +++ b/packaging/gstreamer.spec @@ -62,7 +62,7 @@ Name: %{_name} Version: 1.20.0 -Release: 46 +Release: 47 Summary: Streaming-Media Framework Runtime License: LGPL-2.0+ Group: Multimedia/Framework diff --git a/subprojects/gst-plugins-base/gst/videoconvert/gstvideoconvert.c b/subprojects/gst-plugins-base/gst/videoconvert/gstvideoconvert.c index 4eb8a4e08c..d7c3e838f3 100644 --- a/subprojects/gst-plugins-base/gst/videoconvert/gstvideoconvert.c +++ b/subprojects/gst-plugins-base/gst/videoconvert/gstvideoconvert.c @@ -886,7 +886,8 @@ gst_video_convert_decide_allocation (GstBaseTransform * trans, GstVideoFilter *filter = GST_VIDEO_FILTER_CAST (trans); vc = GST_VIDEO_CONVERT_CAST(trans); - if (filter->out_info.finfo->format == GST_VIDEO_FORMAT_SN12 ) { + if (filter->in_info.finfo->format != filter->out_info.finfo->format && + filter->out_info.finfo->format == GST_VIDEO_FORMAT_SN12) { guint size; GstStructure *config; GstCaps *caps = NULL; @@ -897,25 +898,26 @@ gst_video_convert_decide_allocation (GstBaseTransform * trans, size = vinfo.size; - if (caps) { - vc->pool = gst_tizen_buffer_pool_new (); - config = gst_buffer_pool_get_config (vc->pool); + if (!caps) { + GST_WARNING_OBJECT (vc, "Not using our internal pool and copying buffers for downstream"); + return FALSE; + } - gst_buffer_pool_config_set_params (config, caps, size, 4, 10); - gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); - gst_buffer_pool_set_config (vc->pool, config); + GST_INFO_OBJECT (vc, "Creating Tizen buffer pool"); - if (!gst_buffer_pool_set_active (vc->pool, TRUE)) { - gst_object_unref (vc->pool); - vc->pool = NULL; - GST_INFO ("Failed to activate internal pool"); - } - } else { - GST_ERROR("Not using our internal pool and copying buffers for downstream"); - return FALSE; + vc->pool = gst_tizen_buffer_pool_new (); + config = gst_buffer_pool_get_config (vc->pool); + + gst_buffer_pool_config_set_params (config, caps, size, 4, 10); + gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); + gst_buffer_pool_set_config (vc->pool, config); + + if (!gst_buffer_pool_set_active (vc->pool, TRUE)) { + gst_object_unref (vc->pool); + vc->pool = NULL; + GST_WARNING_OBJECT (vc, "Failed to activate Tizen buffer pool"); } } - GST_DEBUG("[%s]Creating Tizen Buffer Pool", __FUNCTION__); return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans, query); } @@ -930,19 +932,22 @@ gst_video_convert_prepare_output_buffer (GstBaseTransform * trans, vc = GST_VIDEO_CONVERT_CAST (trans); - if (filter->out_info.finfo->format == GST_VIDEO_FORMAT_SN12 ) { - if (gst_buffer_pool_acquire_buffer (vc->pool, &buf, 0) != GST_FLOW_OK) { - GST_ERROR("[%s] memory prepare failed.",__FUNCTION__); - return GST_FLOW_ERROR; - } - - if (input != buf) - GST_BASE_TRANSFORM_CLASS (parent_class)->copy_metadata (trans, input, buf); - *outbuf = buf; + if (!vc->pool) + return GST_BASE_TRANSFORM_CLASS (parent_class)->prepare_output_buffer(trans, input, outbuf); - return GST_FLOW_OK; + if (gst_buffer_pool_acquire_buffer (vc->pool, &buf, 0) != GST_FLOW_OK) { + GST_ERROR_OBJECT (vc, "acquire buffer failed"); + return GST_FLOW_ERROR; } - return GST_BASE_TRANSFORM_CLASS (parent_class)->prepare_output_buffer(trans, input, outbuf); + + GST_DEBUG_OBJECT (vc, "acquired buffer %p", buf); + + if (input != buf) + GST_BASE_TRANSFORM_CLASS (parent_class)->copy_metadata (trans, input, buf); + + *outbuf = buf; + + return GST_FLOW_OK; } #endif