mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 05:16:05 +00:00
outputselector: Improve get and set caps functions
Improve sink pad getcaps and setcaps by handling the case where no src pads exist yet
This commit is contained in:
parent
39b0ba827a
commit
f552659504
1 changed files with 14 additions and 10 deletions
|
@ -295,18 +295,20 @@ static GstCaps *
|
|||
gst_output_selector_sink_getcaps (GstPad * pad)
|
||||
{
|
||||
GstOutputSelector *sel = GST_OUTPUT_SELECTOR (GST_PAD_PARENT (pad));
|
||||
GstPad *active;
|
||||
GstCaps *caps;
|
||||
GstPad *active = NULL;
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
GST_OBJECT_LOCK (sel);
|
||||
if (sel->pending_srcpad)
|
||||
active = gst_object_ref (sel->pending_srcpad);
|
||||
else
|
||||
else if (sel->active_srcpad)
|
||||
active = gst_object_ref (sel->active_srcpad);
|
||||
GST_OBJECT_UNLOCK (sel);
|
||||
|
||||
caps = gst_pad_peer_get_caps_reffed (active);
|
||||
gst_object_unref (active);
|
||||
if (active) {
|
||||
caps = gst_pad_peer_get_caps_reffed (active);
|
||||
gst_object_unref (active);
|
||||
}
|
||||
if (caps == NULL) {
|
||||
caps = gst_caps_new_any ();
|
||||
}
|
||||
|
@ -317,18 +319,20 @@ static gboolean
|
|||
gst_output_selector_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||
{
|
||||
GstOutputSelector *sel = GST_OUTPUT_SELECTOR (GST_PAD_PARENT (pad));
|
||||
GstPad *active;
|
||||
gboolean ret;
|
||||
GstPad *active = NULL;
|
||||
gboolean ret = TRUE;
|
||||
|
||||
GST_OBJECT_LOCK (sel);
|
||||
if (sel->pending_srcpad)
|
||||
active = gst_object_ref (sel->pending_srcpad);
|
||||
else
|
||||
else if (sel->active_srcpad)
|
||||
active = gst_object_ref (sel->active_srcpad);
|
||||
GST_OBJECT_UNLOCK (sel);
|
||||
|
||||
ret = gst_pad_set_caps (active, caps);
|
||||
gst_object_unref (active);
|
||||
if (active) {
|
||||
ret = gst_pad_set_caps (active, caps);
|
||||
gst_object_unref (active);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue