validate: Properly handle proxy pads generating detailed info about NNEs

In cases where we had a two consecutive bins with proxy pads, we could
segfault because we were dereferencing a NULL pointer to pad.
This commit is contained in:
Thibault Saunier 2016-11-30 13:32:09 -03:00
parent ab614e63ae
commit 79faf44d32
2 changed files with 20 additions and 10 deletions

View 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);

View 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.',