From: Hyunsoo Park Date: Mon, 25 Nov 2019 06:25:27 +0000 (+0900) Subject: [wfdtizensrc] Check condition of 'gst_pad_link' X-Git-Tag: accepted/tizen/unified/20191213.042434~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25788d7ee645f58050f7b674d9fe64ec1a5ecad0;p=platform%2Fupstream%2Fgst-plugins-tizen.git [wfdtizensrc] Check condition of 'gst_pad_link' Checks whether it is true or not. Change-Id: Ie4ef95763216f31bc5b5ceea7541209476093663 Signed-off-by: Hyunsoo Park --- diff --git a/wfdtizenmanager/gstwfdtizensrc.c b/wfdtizenmanager/gstwfdtizensrc.c index a80c8db..6c7e03d 100644 --- a/wfdtizenmanager/gstwfdtizensrc.c +++ b/wfdtizenmanager/gstwfdtizensrc.c @@ -1125,6 +1125,7 @@ gst_wfd_tizen_src_configure_udp_sinks (GstWFDTizenSrc * src, GSocket *socket = NULL; gint rtp_port = -1, rtcp_port = -1, rtcp_fb_port = -1; gboolean do_rtcp, do_rtcp_fb; + GstPadLinkReturn res = GST_PAD_LINK_REFUSED; const gchar *destination = NULL; gchar *uri = NULL; GstPad *rtcp_fb_pad = NULL; @@ -1189,13 +1190,15 @@ gst_wfd_tizen_src_configure_udp_sinks (GstWFDTizenSrc * src, pad = gst_element_get_request_pad (src->session, "send_rtcp_src"); /* and link */ - if (pad && rtcppad) { - gst_pad_link_full (pad, rtcppad, GST_PAD_LINK_CHECK_NOTHING); - } + if (pad && rtcppad) + res = gst_pad_link_full (pad, rtcppad, GST_PAD_LINK_CHECK_NOTHING); + if (pad) gst_object_unref (pad); if (rtcppad) gst_object_unref (rtcppad); + if (res != GST_PAD_LINK_OK) + goto link_failed; } if (do_rtcp_fb) { @@ -1233,13 +1236,14 @@ gst_wfd_tizen_src_configure_udp_sinks (GstWFDTizenSrc * src, pad = gst_element_get_static_pad (src->requester, "rtcp_src"); /* and link */ - if (rtcp_fb_pad && pad) { - gst_pad_link (pad, rtcp_fb_pad); - } + if (rtcp_fb_pad && pad) + res = gst_pad_link (pad, rtcp_fb_pad); if (pad) gst_object_unref (pad); if (rtcp_fb_pad) gst_object_unref (rtcp_fb_pad); + if (res != GST_PAD_LINK_OK) + goto link_failed; } return TRUE; @@ -1247,12 +1251,17 @@ gst_wfd_tizen_src_configure_udp_sinks (GstWFDTizenSrc * src, /* ERRORS */ no_destination: { - GST_DEBUG_OBJECT (src, "no destination address specified"); + GST_ERROR_OBJECT (src, "no destination address specified"); return FALSE; } no_sink_element: { - GST_DEBUG_OBJECT (src, "no UDP sink element found"); + GST_ERROR_OBJECT (src, "no UDP sink element found"); + return FALSE; + } +link_failed: + { + GST_ERROR_OBJECT (src, "pad linking is failed [%d]", res); return FALSE; } }