mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
gstqueue, gstqueue2: check if parent of pad is NULL in _getcaps
Parent of the pad (the queue) may be set to NULL while there is a buffer alloc going on.
This commit is contained in:
parent
ba6054b862
commit
339df347a0
2 changed files with 10 additions and 2 deletions
|
@ -487,13 +487,17 @@ gst_queue_getcaps (GstPad * pad)
|
||||||
GstPad *otherpad;
|
GstPad *otherpad;
|
||||||
GstCaps *result;
|
GstCaps *result;
|
||||||
|
|
||||||
queue = GST_QUEUE (GST_PAD_PARENT (pad));
|
queue = GST_QUEUE (gst_pad_get_parent (pad));
|
||||||
|
if (G_UNLIKELY (queue == NULL))
|
||||||
|
return gst_caps_new_any ();
|
||||||
|
|
||||||
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
|
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
|
||||||
result = gst_pad_peer_get_caps (otherpad);
|
result = gst_pad_peer_get_caps (otherpad);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
result = gst_caps_new_any ();
|
result = gst_caps_new_any ();
|
||||||
|
|
||||||
|
gst_object_unref (queue);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -648,13 +648,17 @@ gst_queue2_getcaps (GstPad * pad)
|
||||||
GstPad *otherpad;
|
GstPad *otherpad;
|
||||||
GstCaps *result;
|
GstCaps *result;
|
||||||
|
|
||||||
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
queue = GST_QUEUE2 (gst_pad_get_parent (pad));
|
||||||
|
if (G_UNLIKELY (queue == NULL))
|
||||||
|
return gst_caps_new_any ();
|
||||||
|
|
||||||
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
|
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
|
||||||
result = gst_pad_peer_get_caps (otherpad);
|
result = gst_pad_peer_get_caps (otherpad);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
result = gst_caps_new_any ();
|
result = gst_caps_new_any ();
|
||||||
|
|
||||||
|
gst_object_unref (queue);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue