queue2: Fix deadlock when deactivate is called in pull mode
authorPaweł Stawicki <stawel+gstreamer@gmail.com>
Wed, 31 Aug 2022 16:08:08 +0000 (18:08 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 20 Sep 2022 09:23:22 +0000 (09:23 +0000)
check is flush was called before waiting on condition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2967>

subprojects/gstreamer/plugins/elements/gstqueue2.c

index 3373e1e..a7b160c 100644 (file)
@@ -218,6 +218,9 @@ static GParamSpec *obj_props[PROP_LAST] = { NULL, };
 } G_STMT_END
 
 #define GST_QUEUE2_WAIT_DEL_CHECK(q, res, label) G_STMT_START {         \
+  if (res != GST_FLOW_OK) {                                             \
+    goto label;                                                         \
+  }                                                                     \
   STATUS (queue, q->sinkpad, "wait for DEL");                           \
   q->waiting_del = TRUE;                                                \
   g_cond_wait (&q->item_del, &queue->qlock);                              \
@@ -230,6 +233,9 @@ static GParamSpec *obj_props[PROP_LAST] = { NULL, };
 } G_STMT_END
 
 #define GST_QUEUE2_WAIT_ADD_CHECK(q, res, label) G_STMT_START {         \
+  if (res != GST_FLOW_OK) {                                             \
+    goto label;                                                         \
+  }                                                                     \
   STATUS (queue, q->srcpad, "wait for ADD");                            \
   q->waiting_add = TRUE;                                                \
   g_cond_wait (&q->item_add, &q->qlock);                                  \