webrtc_private: Use const keyword to return type of _ini_get_source_by_type() 17/267617/1 accepted/tizen/unified/20211210.115209 submit/tizen/20211209.025359
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 8 Dec 2021 02:21:14 +0000 (11:21 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 8 Dec 2021 02:24:18 +0000 (11:24 +0900)
The value of returned structure pointer should not be modified.
All the callers are also modified to use the keyword.

[Version] 0.3.15
[Issue Type] Improvement

Change-Id: I14b6c2184835fe94dcf4f0cf4403242068e82cbb
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc_ini.c
src/webrtc_private.c
src/webrtc_source.c

index 0b0ff4d2fc2e397fe9d84a5ddd6db7d5c666c3aa..bf2022df834aa0c582ac4d3da147ab6e3d047eae 100644 (file)
@@ -563,7 +563,7 @@ typedef struct webrtc_signaling_client_s {
 
 int _load_ini(webrtc_s *webrtc);
 void _unload_ini(webrtc_s *webrtc);
-ini_item_media_source_s* _ini_get_source_by_type(webrtc_ini_s *ini, int type);
+const ini_item_media_source_s* _ini_get_source_by_type(webrtc_ini_s *ini, int type);
 bool _is_resource_required(webrtc_ini_s *ini);
 
 int _webrtc_stop(webrtc_s *webrtc);
index 92b29d77072bedafb21b8a258f53ef2a9ca108ed..bb6ed822a4250ffdeb793b99072761d0aa58ff21 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.14
+Version:    0.3.15
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 9d5dddacea418837599a20a0c42b13d2027a7238..de89eb2d6092adcfb17c9c34c4a71b9207581e78 100644 (file)
@@ -505,7 +505,7 @@ int _load_ini(webrtc_s *webrtc)
        return WEBRTC_ERROR_NONE;
 }
 
-ini_item_media_source_s* _ini_get_source_by_type(webrtc_ini_s *ini, int type)
+const ini_item_media_source_s* _ini_get_source_by_type(webrtc_ini_s *ini, int type)
 {
        RET_VAL_IF(ini == NULL, NULL, "ini is NULL");
 
index ec20681a88bd69ac09420b9ed9e521b63fd8e19b..27141582e46444c80b8000a2253ae10baf43b740 100644 (file)
@@ -1168,7 +1168,7 @@ static void __webrtcbin_on_new_transceiver_cb(GstElement *webrtcbin, GstWebRTCRT
        GHashTableIter iter;
        gpointer key, value;
        webrtc_gst_slot_s *source;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
        int i;
 
        RET_IF(webrtcbin == NULL, "webrtcbin is NULL");
index 860b257ee26c438f7eceb7cae4cb1cc51c2cbddd..e82712f3dfd4c4040a5323651cd7679fc1a86a19 100644 (file)
@@ -285,7 +285,7 @@ static bool __is_supported_mime_type(media_format_mimetype_e mime_type)
 static GstCaps *__make_video_raw_caps_with_resolution(webrtc_gst_slot_s *source, webrtc_ini_s *ini, int width, int height)
 {
        GstCaps *caps = NULL;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(source == NULL, NULL, "source is NULL");
        RET_VAL_IF(ini == NULL, NULL, "ini is NULL");
@@ -318,7 +318,7 @@ static GstCaps *__make_video_raw_caps_with_resolution(webrtc_gst_slot_s *source,
 static GstCaps *__make_default_raw_caps(webrtc_gst_slot_s *source, webrtc_ini_s *ini)
 {
        GstCaps *caps = NULL;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
        GstAudioInfo info;
        GstAudioFormat format;
 
@@ -507,7 +507,7 @@ static GstCaps *__get_caps_from_encoded_video_media_type(const char *media_type,
 static GstCaps *__make_default_encoded_caps(webrtc_gst_slot_s *source, webrtc_ini_s *ini, gchar **media_type)
 {
        GstCaps *caps;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
        const char *_media_type;
 
        RET_VAL_IF(source == NULL, NULL, "source is NULL");
@@ -644,7 +644,7 @@ static GstCaps *__make_rtp_caps(const gchar *media_type, unsigned int payload_id
 
 static bool __is_hw_encoder_used(webrtc_s *webrtc, webrtc_media_source_type_e source_type, media_type_e media_type)
 {
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, NULL, "webrtc is NULL");
 
@@ -674,7 +674,7 @@ static bool __is_hw_encoder_used(webrtc_s *webrtc, webrtc_media_source_type_e so
 
 static GstElement *__get_hw_encoder_element(webrtc_s *webrtc, webrtc_gst_slot_s *source)
 {
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
        GstElement *encoder = NULL;
 
        RET_VAL_IF(webrtc == NULL, NULL, "webrtc is NULL");
@@ -714,7 +714,7 @@ static GstElement *__get_hw_encoder_element(webrtc_s *webrtc, webrtc_gst_slot_s
 
 static bool __is_encoded_format_supported(webrtc_media_source_type_e type, webrtc_ini_s *ini)
 {
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(ini == NULL, NULL, "ini is NULL");
 
@@ -1078,7 +1078,7 @@ static const char *__get_default_element(int type)
 
 static const char *__get_source_element(webrtc_s *webrtc, int type)
 {
-       ini_item_media_source_s *source;
+       const ini_item_media_source_s *source;
 
        RET_VAL_IF(webrtc == NULL, NULL, "webrtc is NULL");
 
@@ -1307,7 +1307,7 @@ static int __build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GList *switch_src_list = NULL;
        GList *element_list = NULL;
        GstPad *src_pad;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1407,7 +1407,7 @@ static int __build_camerasrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1482,7 +1482,7 @@ static int __build_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source, bool us
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1552,7 +1552,7 @@ static int __build_videotestsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1618,7 +1618,7 @@ static int __build_custom_videosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1685,7 +1685,7 @@ static int __build_custom_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
-       ini_item_media_source_s *ini_source;
+       const ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -3022,8 +3022,7 @@ int _set_video_resolution(webrtc_s *webrtc, unsigned int source_id, int width, i
        RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the media packet source");
 
        if (webrtc->state != WEBRTC_STATE_IDLE) {
-               ini_item_media_source_s *ini_source;
-               ini_source = _ini_get_source_by_type(&webrtc->ini, source->type);
+               const ini_item_media_source_s *ini_source = _ini_get_source_by_type(&webrtc->ini, source->type);
                if (ini_source == NULL)
                        ini_source = &webrtc->ini.media_source;
                RET_VAL_IF(!ini_source->v_drc_support, WEBRTC_ERROR_INVALID_OPERATION, "not supported dynamic resolution change");