[wfdtizensrc] Check condition of 'gst_pad_link' 25/218525/10
authorHyunsoo Park <hance.park@samsung.com>
Mon, 25 Nov 2019 06:25:27 +0000 (15:25 +0900)
committerHyunsoo Park <hance.park@samsung.com>
Wed, 11 Dec 2019 04:53:19 +0000 (13:53 +0900)
Checks whether it is true or not.

Change-Id: Ie4ef95763216f31bc5b5ceea7541209476093663
Signed-off-by: Hyunsoo Park <hance.park@samsung.com>
wfdtizenmanager/gstwfdtizensrc.c

index a80c8db..6c7e03d 100644 (file)
@@ -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;
   }
 }