mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 07:08:23 +00:00
basesrc: Don't bother the subclass with setting the same caps multiple times
This commit is contained in:
parent
969841f893
commit
674b555bec
1 changed files with 15 additions and 4 deletions
|
@ -906,16 +906,27 @@ gst_base_src_set_caps (GstBaseSrc * src, GstCaps * caps)
|
|||
{
|
||||
GstBaseSrcClass *bclass;
|
||||
gboolean res = TRUE;
|
||||
GstCaps *current_caps;
|
||||
|
||||
bclass = GST_BASE_SRC_GET_CLASS (src);
|
||||
|
||||
gst_base_src_send_stream_start (src);
|
||||
|
||||
if (bclass->set_caps)
|
||||
res = bclass->set_caps (src, caps);
|
||||
current_caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (src));
|
||||
if (current_caps && gst_caps_is_equal (current_caps, caps)) {
|
||||
GST_DEBUG_OBJECT (src, "New caps equal to old ones: %" GST_PTR_FORMAT,
|
||||
caps);
|
||||
res = TRUE;
|
||||
} else {
|
||||
if (bclass->set_caps)
|
||||
res = bclass->set_caps (src, caps);
|
||||
|
||||
if (res)
|
||||
res = gst_pad_push_event (src->srcpad, gst_event_new_caps (caps));
|
||||
if (res)
|
||||
res = gst_pad_push_event (src->srcpad, gst_event_new_caps (caps));
|
||||
}
|
||||
|
||||
if (current_caps)
|
||||
gst_caps_unref (current_caps);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue