Commit de4b0ef7 authored by Stefan Kost's avatar Stefan Kost
Browse files

goom,monoscope: truncate own caps, instead of copying and using the first only

We got the caps from an intersect, it is our own, hence we can truncate it.
parent c4664252
......@@ -262,7 +262,7 @@ gst_goom_src_setcaps (GstPad * pad, GstCaps * caps)
static gboolean
gst_goom_src_negotiate (GstGoom * goom)
{
GstCaps *othercaps, *target, *intersect;
GstCaps *othercaps, *target;
GstStructure *structure;
const GstCaps *templ;
......@@ -273,14 +273,13 @@ gst_goom_src_negotiate (GstGoom * goom)
/* see what the peer can do */
othercaps = gst_pad_peer_get_caps (goom->srcpad);
if (othercaps) {
intersect = gst_caps_intersect (othercaps, templ);
target = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
if (gst_caps_is_empty (intersect))
if (gst_caps_is_empty (target))
goto no_format;
target = gst_caps_copy_nth (intersect, 0);
gst_caps_unref (intersect);
gst_caps_truncate (target);
} else {
target = gst_caps_ref ((GstCaps *) templ);
}
......@@ -297,7 +296,7 @@ gst_goom_src_negotiate (GstGoom * goom)
no_format:
{
gst_caps_unref (intersect);
gst_caps_unref (target);
return FALSE;
}
}
......
......@@ -262,7 +262,7 @@ gst_goom_src_setcaps (GstPad * pad, GstCaps * caps)
static gboolean
gst_goom_src_negotiate (GstGoom * goom)
{
GstCaps *othercaps, *target, *intersect;
GstCaps *othercaps, *target;
GstStructure *structure;
const GstCaps *templ;
......@@ -273,14 +273,13 @@ gst_goom_src_negotiate (GstGoom * goom)
/* see what the peer can do */
othercaps = gst_pad_peer_get_caps (goom->srcpad);
if (othercaps) {
intersect = gst_caps_intersect (othercaps, templ);
target = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
if (gst_caps_is_empty (intersect))
if (gst_caps_is_empty (target))
goto no_format;
target = gst_caps_copy_nth (intersect, 0);
gst_caps_unref (intersect);
gst_caps_truncate (target);
} else {
target = gst_caps_ref ((GstCaps *) templ);
}
......@@ -297,7 +296,7 @@ gst_goom_src_negotiate (GstGoom * goom)
no_format:
{
gst_caps_unref (intersect);
gst_caps_unref (target);
return FALSE;
}
}
......
......@@ -239,7 +239,7 @@ gst_monoscope_src_setcaps (GstPad * pad, GstCaps * caps)
static gboolean
gst_monoscope_src_negotiate (GstMonoscope * monoscope)
{
GstCaps *othercaps, *target, *intersect;
GstCaps *othercaps, *target;
GstStructure *structure;
const GstCaps *templ;
......@@ -250,14 +250,13 @@ gst_monoscope_src_negotiate (GstMonoscope * monoscope)
/* see what the peer can do */
othercaps = gst_pad_peer_get_caps (monoscope->srcpad);
if (othercaps) {
intersect = gst_caps_intersect (othercaps, templ);
target = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
if (gst_caps_is_empty (intersect))
if (gst_caps_is_empty (target))
goto no_format;
target = gst_caps_copy_nth (intersect, 0);
gst_caps_unref (intersect);
gst_caps_truncate (target);
} else {
target = gst_caps_ref ((GstCaps *) templ);
}
......@@ -274,7 +273,7 @@ gst_monoscope_src_negotiate (GstMonoscope * monoscope)
no_format:
{
gst_caps_unref (intersect);
gst_caps_unref (target);
return FALSE;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment