From: Jeongmo Yang Date: Thu, 17 Aug 2023 02:52:19 +0000 (+0900) Subject: Bug fix for GStreamer port X-Git-Tag: accepted/tizen/7.0/unified/20230821.170214^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc617d87d8f79bd7eada569301dea1fa042de188;p=platform%2Fcore%2Fapi%2Fmediacodec.git Bug fix for GStreamer port 1. The capsfilter element is missed for video encoder pipeline. 2. The bitrate property is set even though it's not encoder. 3. The GstMemory is not appended in GstBuffer for SW video encoder. [Version] 0.6.30 [Issue Type] Bug fix Change-Id: I41804e3bf2be48d63013c329b9684908f5c1b909 Signed-off-by: Jeongmo Yang --- diff --git a/packaging/capi-media-codec.spec b/packaging/capi-media-codec.spec index 90c1480..664242c 100644 --- a/packaging/capi-media-codec.spec +++ b/packaging/capi-media-codec.spec @@ -4,7 +4,7 @@ Name: capi-media-codec Summary: A Media Codec library in Tizen Native API -Version: 0.6.29 +Version: 0.6.30 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_codec_port_gst.c b/src/media_codec_port_gst.c index 1eb6e84..5b244fe 100644 --- a/src/media_codec_port_gst.c +++ b/src/media_codec_port_gst.c @@ -317,6 +317,7 @@ static int __mc_fill_input_buffer_with_venc_packet(mc_gst_core_t *core, media_pa gint height; uint32_t plane_num; guint8 *planes[2]; + GstMemory *mem = NULL; mc_gst_port_def_t *port_def = &core->ports[in_port_index]->port_def; @@ -388,18 +389,23 @@ static int __mc_fill_input_buffer_with_venc_packet(mc_gst_core_t *core, media_pa mcbuffer->buf_size += buf_size; } } - } else { - GstMemory *mem = NULL; + mem = gst_memory_new_wrapped(GST_MEMORY_FLAG_READONLY, + planes[0], mcbuffer->buf_size, 0, + mcbuffer->buf_size, mcbuffer, + (GDestroyNotify)__mc_input_buffer_finalize_cb); + } else { mem = __mc_gst_make_tbm_buffer(core, mcbuffer); - if (mem == NULL) { - LOGW("Failed to make tizen memory"); - return MC_ERROR; - } + LOGD("tizen memory[%p]", mem); + } - gst_buffer_append_memory(mcbuffer->buffer, mem); - LOGD("tizen memory appended"); + if (mem == NULL) { + LOGE("gstmemory failed[is_hw:%d]", core->is_hw); + return MC_ERROR; } + + gst_buffer_append_memory(mcbuffer->buffer, mem); + return ret; } @@ -1277,9 +1283,6 @@ static gpointer feed_task(gpointer data) } if (is_format_change) { - int bitrate = core->video ? \ - core->ports[in_port_index]->port_def.info.video.bitrate : \ - core->ports[in_port_index]->port_def.info.audio.bitrate; GstCaps *caps = core->mc_caps_new(core, core->codec_id, in_port_index); g_object_set(core->appsrc, "caps", caps, NULL); @@ -1287,10 +1290,16 @@ static gpointer feed_task(gpointer data) LOGD("caps updated"); - g_object_set(core->codec, core->codec_type->property->bitrate_name, bitrate, NULL); + if (core->encoder) { + int bitrate = core->video ? \ + core->ports[in_port_index]->port_def.info.video.bitrate : \ + core->ports[in_port_index]->port_def.info.audio.bitrate; - LOGI("bitrate[property:%s,v:%d] %d updated", - core->codec_type->property->bitrate_name, core->video, bitrate); + g_object_set(core->codec, core->codec_type->property->bitrate_name, bitrate, NULL); + + LOGI("bitrate[property:%s,v:%d] %d updated", + core->codec_type->property->bitrate_name, core->video, bitrate); + } is_format_change = FALSE; } @@ -2193,7 +2202,7 @@ mc_ret_e _mc_gst_create_pipeline(mc_gst_core_t *core, const gchar *factory_name) gst_bin_add_many(GST_BIN(core->pipeline), core->appsrc, core->capsfilter, core->codec, core->fakesink, NULL); /* link elements */ - if (!(gst_element_link_many(core->appsrc, core->codec, core->fakesink, NULL))) { + if (!(gst_element_link_many(core->appsrc, core->capsfilter, core->codec, core->fakesink, NULL))) { LOGE("gst_element_link_many is failed"); goto ERROR; }