From: Sangchul Lee Date: Wed, 8 Dec 2021 02:21:14 +0000 (+0900) Subject: webrtc_private: Use const keyword to return type of _ini_get_source_by_type() X-Git-Tag: submit/tizen/20211209.025359^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7792d1938044af177f1075b616580805b56ca270;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_private: Use const keyword to return type of _ini_get_source_by_type() 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 --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 0b0ff4d2..bf2022df 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -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); diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 92b29d77..bb6ed822 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.14 +Version: 0.3.15 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_ini.c b/src/webrtc_ini.c index 9d5dddac..de89eb2d 100644 --- a/src/webrtc_ini.c +++ b/src/webrtc_ini.c @@ -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"); diff --git a/src/webrtc_private.c b/src/webrtc_private.c index ec20681a..27141582 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -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"); diff --git a/src/webrtc_source.c b/src/webrtc_source.c index 860b257e..e82712f3 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -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");