camerabin: don't leak sink_caps if they would be any-caps

This commit is contained in:
Stefan Kost 2009-06-26 18:32:40 +03:00
parent a5e9a5eebc
commit c9208657b1

View file

@ -2210,7 +2210,8 @@ gst_camerabin_update_aspect_filter (GstCameraBin * camera, GstCaps * new_caps)
if (sink_pad) { if (sink_pad) {
sink_caps = gst_pad_get_caps (sink_pad); sink_caps = gst_pad_get_caps (sink_pad);
gst_object_unref (sink_pad); gst_object_unref (sink_pad);
if (sink_caps && !gst_caps_is_any (sink_caps)) { if (sink_caps) {
if (!gst_caps_is_any (sink_caps)) {
GST_DEBUG_OBJECT (camera, "sink element caps %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (camera, "sink element caps %" GST_PTR_FORMAT,
sink_caps); sink_caps);
/* Get maximum resolution that view finder sink accepts */ /* Get maximum resolution that view finder sink accepts */
@ -2223,7 +2224,6 @@ gst_camerabin_update_aspect_filter (GstCameraBin * camera, GstCaps * new_caps)
range = gst_structure_get_value (st, "height"); range = gst_structure_get_value (st, "height");
sink_h = gst_value_get_int_range_max (range); sink_h = gst_value_get_int_range_max (range);
} }
gst_caps_unref (sink_caps);
GST_DEBUG_OBJECT (camera, "sink element accepts max %dx%d", sink_w, GST_DEBUG_OBJECT (camera, "sink element accepts max %dx%d", sink_w,
sink_h); sink_h);
@ -2235,6 +2235,8 @@ gst_camerabin_update_aspect_filter (GstCameraBin * camera, GstCaps * new_caps)
GST_DEBUG_OBJECT (camera, "new caps with %dx%d", in_w, in_h); GST_DEBUG_OBJECT (camera, "new caps with %dx%d", in_w, in_h);
} }
} }
gst_caps_unref (sink_caps);
}
} }
/* If we get bigger frames than view finder sink accepts, then we scale. /* If we get bigger frames than view finder sink accepts, then we scale.