mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
multiqueue: two small fixes for when an existing pad is requested
Unlock when returning NULL from gst_single_queue_new(), and don't crash with debug logging enabled if NULL is returned. Spotted by Steven Hoving.
This commit is contained in:
parent
eaa992825d
commit
469475f06b
1 changed files with 9 additions and 5 deletions
|
@ -762,6 +762,7 @@ gst_multi_queue_request_new_pad (GstElement * element, GstPadTemplate * temp,
|
||||||
{
|
{
|
||||||
GstMultiQueue *mqueue = GST_MULTI_QUEUE (element);
|
GstMultiQueue *mqueue = GST_MULTI_QUEUE (element);
|
||||||
GstSingleQueue *squeue;
|
GstSingleQueue *squeue;
|
||||||
|
GstPad *new_pad;
|
||||||
guint temp_id = -1;
|
guint temp_id = -1;
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
|
@ -772,10 +773,11 @@ gst_multi_queue_request_new_pad (GstElement * element, GstPadTemplate * temp,
|
||||||
/* Create a new single queue, add the sink and source pad and return the sink pad */
|
/* Create a new single queue, add the sink and source pad and return the sink pad */
|
||||||
squeue = gst_single_queue_new (mqueue, temp_id);
|
squeue = gst_single_queue_new (mqueue, temp_id);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (mqueue, "Returning pad %s:%s",
|
new_pad = squeue ? squeue->sinkpad : NULL;
|
||||||
GST_DEBUG_PAD_NAME (squeue->sinkpad));
|
|
||||||
|
|
||||||
return squeue ? squeue->sinkpad : NULL;
|
GST_DEBUG_OBJECT (mqueue, "Returning pad %" GST_PTR_FORMAT, new_pad);
|
||||||
|
|
||||||
|
return new_pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2627,10 +2629,12 @@ gst_single_queue_new (GstMultiQueue * mqueue, guint id)
|
||||||
if (sq2->id == temp_id) {
|
if (sq2->id == temp_id) {
|
||||||
/* If this ID was requested by the caller return NULL,
|
/* If this ID was requested by the caller return NULL,
|
||||||
* otherwise just get us the next one */
|
* otherwise just get us the next one */
|
||||||
if (id == -1)
|
if (id == -1) {
|
||||||
temp_id = sq2->id + 1;
|
temp_id = sq2->id + 1;
|
||||||
else
|
} else {
|
||||||
|
GST_MULTI_QUEUE_MUTEX_UNLOCK (mqueue);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
} else if (sq2->id > temp_id) {
|
} else if (sq2->id > temp_id) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue