rtpjitterbuffer: Check srcresult before waiting on the condition variable too
authorSebastian Dröge <sebastian@centricular.com>
Tue, 13 Apr 2021 08:30:51 +0000 (11:30 +0300)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 13 Apr 2021 12:30:49 +0000 (12:30 +0000)
It might've been set to FLUSHING between the last check and the waiting,
and in that case we'd be waiting here forever now.

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

gst/rtpmanager/gstrtpjitterbuffer.c

index 7f677f0..6f7185c 100644 (file)
@@ -234,6 +234,8 @@ enum
 } G_STMT_END
 
 #define JBUF_WAIT_EVENT(priv,label) G_STMT_START {       \
+  if (G_UNLIKELY (priv->srcresult != GST_FLOW_OK))       \
+    goto label;                                          \
   GST_DEBUG ("waiting event");                           \
   (priv)->waiting_event = TRUE;                          \
   g_cond_wait (&(priv)->jbuf_event, &(priv)->jbuf_lock); \
@@ -250,6 +252,8 @@ enum
 } G_STMT_END
 
 #define JBUF_WAIT_QUERY(priv,label) G_STMT_START {       \
+  if (G_UNLIKELY (priv->srcresult != GST_FLOW_OK))       \
+    goto label;                                          \
   GST_DEBUG ("waiting query");                           \
   (priv)->waiting_query = TRUE;                          \
   g_cond_wait (&(priv)->jbuf_query, &(priv)->jbuf_lock); \