validate:pad-monitor: Accept any return value when we aggregated FLUSHING while teari...
authorThibault Saunier <tsaunier@igalia.com>
Tue, 26 Mar 2019 13:47:12 +0000 (10:47 -0300)
committerThibault Saunier <tsaunier@gnome.org>
Wed, 3 Apr 2019 13:38:42 +0000 (13:38 +0000)
Basically nothing guarantees that the set of pads we aggregated the flow
for is the same as the one that was aggregated during the actual data
flow as some pads could have been removed meanwhile.

validate/gst/validate/gst-validate-pad-monitor.c
validate/tests/check/validate/padmonitor.c

index 2f5ff21..c3c157b 100644 (file)
@@ -1338,6 +1338,7 @@ gst_validate_pad_monitor_check_aggregated_return (GstValidatePadMonitor *
   gboolean done;
   GstPad *otherpad;
   GstPad *peerpad;
+  GstState state, pending;
   GstValidatePadMonitor *othermonitor;
   GstFlowReturn aggregated = GST_FLOW_NOT_LINKED;
   gboolean found_a_pad = FALSE;
@@ -1384,8 +1385,17 @@ gst_validate_pad_monitor_check_aggregated_return (GstValidatePadMonitor *
     /* no peer pad found, nothing to do */
     goto done;
   }
-  if (aggregated == GST_FLOW_OK || aggregated == GST_FLOW_EOS) {
-    GstState state, pending;
+
+  if (aggregated == GST_FLOW_FLUSHING) {
+    gst_element_get_state (GST_ELEMENT (parent), &state, &pending, 0);
+    if (state < GST_STATE_PAUSED || pending < GST_STATE_PAUSED) {
+      /* Aggregated is flushing, we might have been aggregating a combination
+       * of pads that are not what was present on the element during the actual
+       * data flow combination (pads might have been removed meanwhile) */
+
+      goto done;
+    }
+  } else if (aggregated == GST_FLOW_OK || aggregated == GST_FLOW_EOS) {
 
     /* those are acceptable situations */
     if (GST_PAD_IS_FLUSHING (pad) && ret == GST_FLOW_FLUSHING) {
index 943e7e3..83083dd 100644 (file)
@@ -378,9 +378,9 @@ GST_START_TEST(flow_aggregation_##name) { \
 
 FLOW_TEST (ok_ok_error_ok, OK, OK, ERROR, OK, TRUE);
 FLOW_TEST (eos_eos_eos_ok, EOS, EOS, EOS, OK, TRUE);
-FLOW_TEST (flushing_ok_ok_ok, FLUSHING, OK, OK, OK, TRUE);
 FLOW_TEST (not_neg_ok_ok_ok, NOT_NEGOTIATED, OK, OK, OK, TRUE);
 /*[> Passing cases: <]*/
+FLOW_TEST (flushing_ok_ok_ok, FLUSHING, OK, OK, OK, FALSE);
 FLOW_TEST (eos_eos_eos_eos, EOS, EOS, EOS, EOS, FALSE);
 FLOW_TEST (eos_eos_ok_ok, EOS, EOS, OK, OK, FALSE);
 FLOW_TEST (ok_ok_ok_eos, OK, OK, OK, EOS, FALSE);