gst/gstqueue.c (gst_queue_link_sink): Grab the lock only when it is necessary to wait.

Original commit message from CVS:
2004-11-24  Martin Soto  <martinsoto@users.sourceforge.net>

* gst/gstqueue.c (gst_queue_link_sink): Grab the lock only when
it is necessary to wait.
This commit is contained in:
Martin Soto 2004-11-24 18:54:35 +00:00
parent eea114a84d
commit 6c376ecbf5
3 changed files with 13 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2004-11-24 Martin Soto <martinsoto@users.sourceforge.net>
* gst/gstqueue.c (gst_queue_link_sink): Grab the lock only when
it is necessary to wait.
2004-11-24 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* docs/pwg/building-boiler.xml:

View file

@ -410,8 +410,6 @@ gst_queue_link_sink (GstPad * pad, const GstCaps * caps)
queue = GST_QUEUE (gst_pad_get_parent (pad));
GST_QUEUE_MUTEX_LOCK;
if (queue->cur_level.bytes > 0) {
if (gst_caps_is_equal (caps, queue->negotiated_caps)) {
GST_QUEUE_MUTEX_UNLOCK;
@ -420,11 +418,15 @@ gst_queue_link_sink (GstPad * pad, const GstCaps * caps)
/* Wait until the queue is empty before attempting the pad
negotiation. */
GST_QUEUE_MUTEX_LOCK;
STATUS (queue, "waiting for queue to get empty");
while (queue->cur_level.bytes > 0) {
g_cond_wait (queue->item_del, queue->qlock);
}
STATUS (queue, "queue is now empty");
GST_QUEUE_MUTEX_UNLOCK;
}
link_ret = gst_pad_proxy_pad_link (pad, caps);
@ -435,8 +437,6 @@ gst_queue_link_sink (GstPad * pad, const GstCaps * caps)
gst_caps_replace (&queue->negotiated_caps, gst_caps_copy (caps));
}
GST_QUEUE_MUTEX_UNLOCK;
return link_ret;
}

View file

@ -410,8 +410,6 @@ gst_queue_link_sink (GstPad * pad, const GstCaps * caps)
queue = GST_QUEUE (gst_pad_get_parent (pad));
GST_QUEUE_MUTEX_LOCK;
if (queue->cur_level.bytes > 0) {
if (gst_caps_is_equal (caps, queue->negotiated_caps)) {
GST_QUEUE_MUTEX_UNLOCK;
@ -420,11 +418,15 @@ gst_queue_link_sink (GstPad * pad, const GstCaps * caps)
/* Wait until the queue is empty before attempting the pad
negotiation. */
GST_QUEUE_MUTEX_LOCK;
STATUS (queue, "waiting for queue to get empty");
while (queue->cur_level.bytes > 0) {
g_cond_wait (queue->item_del, queue->qlock);
}
STATUS (queue, "queue is now empty");
GST_QUEUE_MUTEX_UNLOCK;
}
link_ret = gst_pad_proxy_pad_link (pad, caps);
@ -435,8 +437,6 @@ gst_queue_link_sink (GstPad * pad, const GstCaps * caps)
gst_caps_replace (&queue->negotiated_caps, gst_caps_copy (caps));
}
GST_QUEUE_MUTEX_UNLOCK;
return link_ret;
}