remove raw_format from source structure 06/282106/3 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/hotfix/20221116.104917 accepted/tizen/unified/20220929.140028 tizen_7.0_m2_release
authorhj kim <backto.kim@samsung.com>
Tue, 27 Sep 2022 06:08:55 +0000 (15:08 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 28 Sep 2022 03:21:42 +0000 (12:21 +0900)
Change to get raw_format from ini only when it is needed.

[Version] 0.3.254
[Issue Type] API

Change-Id: I9aba23be4a85964a9a6ffc6dc840e3003823f7b4

include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc_source.c
src/webrtc_source_screen.c

index b4be4588d150bd4111d6f984a505c185f3a6db9c..75cbb094061d897a710c07fd6b7fb2508221276b 100644 (file)
@@ -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;
index 77a6e1fadd0c48a009488da507e62283d5126d72..6a0115cc7752b21d1a885d59d439a998fd6e3a4b 100644 (file)
@@ -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
index c32fb6a9b24e2749ac958149797774dea847f9b6..ec65ebda70292db3337dd81085808a06bb4bd02e 100644 (file)
@@ -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 {
index 1934374c1991916a541e2ae31098801ce0a01135..3018be3ccbc0e41a4e28c38d71c75eba8d945722 100644 (file)
@@ -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))