validate: Properly handle proxy pads generating detailed info about NNEs
authorThibault Saunier <tsaunier@gnome.org>
Wed, 30 Nov 2016 16:32:09 +0000 (13:32 -0300)
committerThibault Saunier <tsaunier@gnome.org>
Wed, 30 Nov 2016 16:58:56 +0000 (13:58 -0300)
In cases where we had a two consecutive bins with proxy pads, we could
segfault because we were dereferencing a NULL pointer to pad.

validate/gst/validate/gst-validate-pipeline-monitor.c
validate/tests/launcher_tests/test_validate.py

index 795e2ca..2d95092 100644 (file)
@@ -146,15 +146,6 @@ _check_pad_query_failures (GstPad * pad, GString * str,
   GstValidatePadMonitor *monitor;
   GstPad *ghost_target = NULL;
 
-  if (GST_IS_GHOST_PAD (pad)) {
-    ghost_target = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
-
-    if (!ghost_target)
-      return;
-
-    pad = ghost_target;
-  }
-
   monitor = g_object_get_data (G_OBJECT (pad), "validate-monitor");
 
   if (monitor->last_query_res && gst_caps_is_empty (monitor->last_query_res)) {
@@ -185,6 +176,25 @@ _gather_pad_negotiation_details (GstPad * pad, GString * str,
   if (!peer)
     return;
 
+  while (GST_IS_PROXY_PAD (peer)) {
+    GstPad *next_pad;
+
+    if (GST_IS_GHOST_PAD (peer)) {
+      next_pad = gst_pad_get_peer (peer);
+
+      if (next_pad == pad)
+        next_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (peer));
+    } else {
+      next_pad = GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (peer)));
+    }
+
+    if (!next_pad)
+      return;
+
+    gst_object_unref (peer);
+    peer = next_pad;
+  }
+
   _check_pad_query_failures (peer, str, last_query_caps_fail_monitor,
       last_refused_caps_monitor);
 
index f034413..34c3fa2 100644 (file)
@@ -34,7 +34,7 @@ def get_pipelines(test_manager):
                  {'level': 'critical', 'summary': 'a NOT NEGOTIATED message has been posted on the bus.',
                   'details': r'.*Caps negotiation failed at pad.*capsfilter:sink.*as it refused caps:.*'}]}),
             ("not_negotiated.caps_query_failure",
-             "audiotestsrc ! input-selector name=i ! capsfilter name=capsfilter caps=video/x-raw ! fakesink",
+             "\( \( audiotestsrc \) ! input-selector name=i \) ! capsfilter name=capsfilter caps=video/x-raw ! fakesink",
              {"expected-failures": [
                  {'returncode': 18},
                  {'level': 'critical', 'summary': 'a NOT NEGOTIATED message has been posted on the bus.',