tests: fix shm test deadlock
authorDoug Nazar <nazard@nazar.ca>
Tue, 13 Apr 2021 10:40:43 +0000 (06:40 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 13 Apr 2021 11:59:35 +0000 (11:59 +0000)
Stopping the consumer first would occasionally allow the producer
to fill the shm segment causing it to block in send() and unable
to be stopped.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2158>

tests/check/elements/shm.c

index 69413cf..fed23c2 100644 (file)
@@ -215,10 +215,10 @@ GST_START_TEST (test_shm_live)
   g_signal_emit_by_name (sink, "pull-sample", &sample);
   gst_sample_unref (sample);
 
-  state_res = gst_element_set_state (consumer, GST_STATE_NULL);
+  state_res = gst_element_set_state (producer, GST_STATE_NULL);
   fail_unless (state_res != GST_STATE_CHANGE_FAILURE);
 
-  state_res = gst_element_set_state (producer, GST_STATE_NULL);
+  state_res = gst_element_set_state (consumer, GST_STATE_NULL);
   fail_unless (state_res != GST_STATE_CHANGE_FAILURE);
 
   gst_object_unref (consumer);