From: Sangchul Lee Date: Thu, 23 Nov 2023 01:56:42 +0000 (+0900) Subject: Remove meaningless parameter checks X-Git-Tag: accepted/tizen/7.0/unified/20231204.175248~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19999d3def6a90b079f4438c54d61cce5ee10a57;p=platform%2Fcore%2Fapi%2Fwebrtc.git Remove meaningless parameter checks The first parameter of callbacks from gstreamer would be always not null. Once webrtc handle has been created, there's no possibility that 'gst.webrtcbin' or 'gst.source_slots' is null. A typo is also fixed. [Version] 0.3.295 [Issue Type] Clean up Change-Id: I03fc688b1b694c86c77d958fe4729734b799b897 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 45c51fe8..25d930e6 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.294 +Version: 0.3.295 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_display.c b/src/webrtc_display.c index 67d9a2e3..9a522edf 100644 --- a/src/webrtc_display.c +++ b/src/webrtc_display.c @@ -232,7 +232,7 @@ static int __get_media_packet_mimetype(int pixel_format, media_format_mimetype_e *mimetype = MEDIA_FORMAT_ARGB; break; default: - LOGE("not suppported pixel_format(%d)", pixel_format); + LOGE("not supported pixel_format(%d)", pixel_format); return WEBRTC_ERROR_INVALID_PARAMETER; } diff --git a/src/webrtc_private.c b/src/webrtc_private.c index c119dc62..98933ab9 100644 --- a/src/webrtc_private.c +++ b/src/webrtc_private.c @@ -1104,7 +1104,6 @@ static void __webrtcbin_on_negotiation_needed_cb(GstElement *webrtcbin, gpointer { webrtc_s *webrtc = (webrtc_s *)user_data; - RET_IF(webrtcbin == NULL, "webrtcbin is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); _post_state_cb_in_idle(webrtc, WEBRTC_STATE_NEGOTIATING); @@ -1127,7 +1126,6 @@ static void __webrtcbin_on_ice_candidate_cb(GstElement *webrtcbin, guint mlinein gchar *candidate_with_hostname = NULL; char *_param_candidate; - RET_IF(webrtcbin == NULL, "webrtcbin is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); RET_IF(webrtc->ice_candidate_cb.callback == NULL, "ice_candidate_cb is NULL"); @@ -1157,7 +1155,6 @@ static void __webrtcbin_peer_connection_state_cb(GstElement *webrtcbin, GParamSp GstWebRTCPeerConnectionState state; g_autoptr(GMutexLocker) locker = NULL; - RET_IF(webrtcbin == NULL, "webrtcbin is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); g_object_get(webrtcbin, "connection-state", &state, NULL); @@ -1213,7 +1210,6 @@ static void __webrtcbin_ice_gathering_state_cb(GstElement *webrtcbin, GParamSpec GstWebRTCICEGatheringState state; g_autoptr(GMutexLocker) locker = NULL; - RET_IF(webrtcbin == NULL, "webrtcbin is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); g_object_get(webrtcbin, "ice-gathering-state", &state, NULL); @@ -1232,7 +1228,6 @@ static void __webrtcbin_ice_connection_state_cb(GstElement *webrtcbin, GParamSpe GstWebRTCICEConnectionState state; g_autoptr(GMutexLocker) locker = NULL; - RET_IF(webrtcbin == NULL, "webrtcbin is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); g_object_get(webrtcbin, "ice-connection-state", &state, NULL); @@ -1479,7 +1474,6 @@ static void __webrtcbin_no_more_pads_cb(GstElement *webrtcbin, gpointer user_dat { webrtc_s *webrtc = (webrtc_s *)user_data; - RET_IF(webrtcbin == NULL, "webrtcbin is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); LOG_DEBUG_LEAVE(); diff --git a/src/webrtc_source.c b/src/webrtc_source.c index ec65ebda..f7e9209f 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -745,7 +745,6 @@ int _set_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e med bool prev; RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "could not find source"); RET_VAL_IF(source->type == WEBRTC_MEDIA_SOURCE_TYPE_NULL, WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the null source"); @@ -779,7 +778,6 @@ int _get_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e med RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(paused == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "paused is NULL"); - RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "could not find source"); RET_VAL_IF(source->type == WEBRTC_MEDIA_SOURCE_TYPE_NULL, WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the null source"); diff --git a/src/webrtc_transceiver.c b/src/webrtc_transceiver.c index 582a2804..35f904a1 100644 --- a/src/webrtc_transceiver.c +++ b/src/webrtc_transceiver.c @@ -87,8 +87,6 @@ void _webrtcbin_on_new_transceiver_cb(GstElement *webrtcbin, GstWebRTCRTPTransce GstWebRTCKind kind; GstCaps *caps; - RET_IF(webrtcbin == NULL, "webrtcbin is NULL"); - RET_IF(transceiver == NULL, "transceiver is NULL"); RET_IF(webrtc == NULL, "webrtc is NULL"); g_object_get(G_OBJECT(transceiver), @@ -437,8 +435,6 @@ int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_ RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(direction > WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV, WEBRTC_ERROR_INVALID_PARAMETER, "invalid direction"); - RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL"); - RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL"); RET_VAL_IF(source->type == WEBRTC_MEDIA_SOURCE_TYPE_NULL && direction != WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY, WEBRTC_ERROR_INVALID_PARAMETER, "null source only allow RECVONLY direction"); @@ -471,8 +467,6 @@ int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_ RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL"); - RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL"); - RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL"); if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) { @@ -554,8 +548,6 @@ int _foreach_supported_transceiver_codec(webrtc_s *webrtc, webrtc_media_source_t RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(callback == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "callback is NULL"); - RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL"); - RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL"); RET_VAL_IF((source_type == WEBRTC_MEDIA_SOURCE_TYPE_FILE), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the file source"); RET_VAL_IF((source_type == WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the media packet source"); RET_VAL_IF((source_type > WEBRTC_MEDIA_SOURCE_TYPE_NULL), WEBRTC_ERROR_INVALID_PARAMETER, "invalid source_type"); @@ -641,8 +633,6 @@ int _set_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_medi rtp_payload_info_s *payload_info = NULL; RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL"); - RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL"); RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the file source"); RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the media packet source"); @@ -682,8 +672,6 @@ int _get_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_medi RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(codec == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "codec is NULL"); - RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL"); - RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL"); if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) { @@ -705,4 +693,4 @@ int _get_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_medi LOG_INFO("webrtc[%p] source_id[%u] media_type[%d] codec[%s]", webrtc, source_id, media_type, codec_str); return WEBRTC_ERROR_NONE; -} \ No newline at end of file +}