Enhance some pad linking issue debug logging.
authorThibault Saunier <thibault.saunier@osg.samsung.com>
Mon, 24 Jul 2017 14:34:48 +0000 (10:34 -0400)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Wed, 26 Jul 2017 23:25:44 +0000 (19:25 -0400)
ges/ges-pipeline.c
ges/ges-source.c

index 3458279..53707c6 100644 (file)
@@ -637,7 +637,7 @@ get_compatible_unlinked_pad (GstElement * element, GESTrack * track)
   pads = gst_element_iterate_sink_pads (element);
   srccaps = ges_track_get_caps (track);
 
-  GST_DEBUG ("srccaps %" GST_PTR_FORMAT, srccaps);
+  GST_DEBUG_OBJECT (track, "srccaps %" GST_PTR_FORMAT, srccaps);
 
   while (!done) {
     switch (gst_iterator_next (pads, &paditem)) {
@@ -648,7 +648,7 @@ get_compatible_unlinked_pad (GstElement * element, GESTrack * track)
         if (!gst_pad_is_linked (testpad)) {
           GstCaps *sinkcaps = gst_pad_query_caps (testpad, NULL);
 
-          GST_DEBUG ("sinkccaps %" GST_PTR_FORMAT, sinkcaps);
+          GST_DEBUG_OBJECT (track, "sinkccaps %" GST_PTR_FORMAT, sinkcaps);
 
           if (gst_caps_can_intersect (srccaps, sinkcaps)) {
             res = gst_object_ref (testpad);
@@ -734,7 +734,8 @@ _link_track (GESPipeline * self, GESTrack * track)
     chain = new_output_chain_for_track (self, track);
 
   if (chain->tee) {
-    GST_INFO_OBJECT (self, "Chain is already built");
+    GST_INFO_OBJECT (self, "Chain is already built (%" GST_PTR_FORMAT ")",
+        chain->encodebinpad ? chain->encodebinpad : chain->playsinkpad);
 
     return;
   }
@@ -828,10 +829,11 @@ _link_track (GESPipeline * self, GESTrack * track)
         /* If no compatible static pad is available, request a pad */
         g_signal_emit_by_name (self->priv->encodebin, "request-pad", caps,
             &sinkpad);
-        gst_caps_unref (caps);
 
         if (G_UNLIKELY (sinkpad == NULL)) {
-          GST_INFO_OBJECT (self, "Couldn't get a pad from encodebin !");
+          GST_INFO_OBJECT (self, "Couldn't get a pad from encodebin for: %"
+              GST_PTR_FORMAT, caps);
+          gst_caps_unref (caps);
           gst_element_set_locked_state (GST_ELEMENT (track), TRUE);
 
           self->priv->not_rendered_tracks =
@@ -840,8 +842,11 @@ _link_track (GESPipeline * self, GESTrack * track)
 
           goto error;
         }
+
+        gst_caps_unref (caps);
       }
       chain->encodebinpad = sinkpad;
+      GST_INFO_OBJECT (track, "Linked to %" GST_PTR_FORMAT, sinkpad);
     }
 
     tmppad = gst_element_get_request_pad (chain->tee, "src_%u");
index 5f597e9..f0ac897 100644 (file)
@@ -45,8 +45,21 @@ struct _GESSourcePrivate
 static void
 _pad_added_cb (GstElement * element, GstPad * srcpad, GstPad * sinkpad)
 {
+  GstPadLinkReturn res;
   gst_element_no_more_pads (element);
-  gst_pad_link (srcpad, sinkpad);
+  res = gst_pad_link (srcpad, sinkpad);
+  if (res != GST_PAD_LINK_OK) {
+    GstCaps *srccaps = NULL;
+    GstCaps *sinkcaps = NULL;
+
+    srccaps = gst_pad_query_caps (srcpad, NULL);
+    sinkcaps = gst_pad_query_caps (sinkpad, NULL);
+
+    GST_ERROR_OBJECT (element, "Could not link source with "
+        "conversion bin: %s (srcpad caps %" GST_PTR_FORMAT
+        " sinkpad caps: %" GST_PTR_FORMAT ")",
+        gst_pad_link_get_name (res), srccaps, sinkcaps);
+  }
 }
 
 static void