From: hj kim Date: Tue, 27 Sep 2022 06:08:55 +0000 (+0900) Subject: remove raw_format from source structure X-Git-Tag: accepted/tizen/unified/20220929.140028^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=981d8a6d6e75fca3da16e59a13e3b13e645d151f;p=platform%2Fcore%2Fapi%2Fwebrtc.git remove raw_format from source structure Change to get raw_format from ini only when it is needed. [Version] 0.3.254 [Issue Type] API Change-Id: I9aba23be4a85964a9a6ffc6dc840e3003823f7b4 --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index b4be4588..75cbb094 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -544,7 +544,6 @@ typedef struct _webrtc_gst_slot_s { const char *codec; GstPad *src_pad; gulong src_pad_probe_id; - gchar *raw_format; int target_bitrate; bool pause; bool mute; diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 77a6e1fa..6a0115cc 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.3.253 +Version: 0.3.254 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source.c b/src/webrtc_source.c index c32fb6a9..ec65ebda 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -216,7 +216,6 @@ static int __build_camerasrc(webrtc_s *webrtc, webrtc_gst_slot_s *source) source->media_types = MEDIA_TYPE_VIDEO; source->zerocopy_enabled = _is_hw_encoder_used(webrtc, source->type, source->media_types); - source->av[AV_IDX_VIDEO].raw_format = g_strdup(ini_source->v_raw_format); source->av[AV_IDX_VIDEO].codec = ini_source->v_codecs[0]; if (!_set_default_video_info(source, ini_source)) @@ -363,7 +362,6 @@ static int __build_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source, bool us source->media_types = MEDIA_TYPE_AUDIO; source->zerocopy_enabled = _is_hw_encoder_used(webrtc, source->type, source->media_types); - source->av[AV_IDX_AUDIO].raw_format = g_strdup(ini_source->a_raw_format); source->av[AV_IDX_AUDIO].codec = ini_source->a_codecs[0]; source_factory_name = _get_source_element(webrtc, use_mic ? WEBRTC_MEDIA_SOURCE_TYPE_MIC : WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST); @@ -395,7 +393,6 @@ static int __build_videotestsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source) source->media_types = MEDIA_TYPE_VIDEO; source->zerocopy_enabled = _is_hw_encoder_used(webrtc, source->type, source->media_types); - source->av[AV_IDX_VIDEO].raw_format = g_strdup(ini_source->v_raw_format); source->av[AV_IDX_VIDEO].codec = ini_source->v_codecs[0]; if (!_set_default_video_info(source, ini_source)) @@ -559,8 +556,6 @@ void _source_slot_destroy_cb(gpointer data) if (source->av[i].transceiver) gst_object_unref(source->av[i].transceiver); - - g_free(source->av[i].raw_format); } if (source->bin) { @@ -1070,6 +1065,7 @@ static GstPadProbeReturn __camerasrc_probe_cb(GstPad *pad, GstPadProbeInfo *info webrtc_gst_slot_s *source = u_data; GstBuffer *buffer = gst_pad_probe_info_get_buffer(info); GstMemory *mem = NULL; + const char *raw_format; RET_VAL_IF(source == NULL, GST_PAD_PROBE_OK, "source is NULL"); RET_VAL_IF(buffer == NULL, GST_PAD_PROBE_OK, "buffer is NULL"); @@ -1078,6 +1074,8 @@ static GstPadProbeReturn __camerasrc_probe_cb(GstPad *pad, GstPadProbeInfo *info mem = gst_buffer_peek_memory(buffer, 0); RET_VAL_IF(mem == NULL, GST_PAD_PROBE_OK, "mem is NULL"); + raw_format = _get_raw_format_from_ini(&source->webrtc->ini, source->type, MEDIA_TYPE_VIDEO); + if (gst_is_tizen_memory(mem)) { tbm_surface_h src_tsurface = NULL; tbm_surface_info_s ts_info; @@ -1092,7 +1090,7 @@ static GstPadProbeReturn __camerasrc_probe_cb(GstPad *pad, GstPadProbeInfo *info } /* fill the buffer with black */ - if (g_strrstr(source->av[AV_IDX_VIDEO].raw_format, "SR32")) { /*RGB*/ + if (g_strrstr(raw_format, "SR32")) { /*RGB*/ for (i = 0 ; i < ts_info.num_planes ; i++) memset(ts_info.planes[i].ptr, 0x00, ts_info.planes[i].size); } else { /*YUV*/ @@ -1110,7 +1108,7 @@ static GstPadProbeReturn __camerasrc_probe_cb(GstPad *pad, GstPadProbeInfo *info } /* fill the buffer with black */ - if (g_strrstr(source->av[AV_IDX_VIDEO].raw_format, "I420") || (g_strrstr(source->av[AV_IDX_VIDEO].raw_format, "NV12"))) { + if (g_strrstr(raw_format, "I420") || (g_strrstr(raw_format, "NV12"))) { memset(map_info.data, 0x10, mem_size * 2 / 3); memset(map_info.data + mem_size * 2 / 3, 0x80, mem_size / 3); } else { diff --git a/src/webrtc_source_screen.c b/src/webrtc_source_screen.c index 1934374c..3018be3c 100644 --- a/src/webrtc_source_screen.c +++ b/src/webrtc_source_screen.c @@ -339,7 +339,6 @@ int _build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source) source->media_types = MEDIA_TYPE_VIDEO; source->zerocopy_enabled = _is_hw_encoder_used(webrtc, source->type, source->media_types); - source->av[AV_IDX_VIDEO].raw_format = g_strdup(ini_source->v_raw_format); source->av[AV_IDX_VIDEO].codec = ini_source->v_codecs[0]; if (!_set_default_video_info(source, ini_source))