summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-07-11 10:40:42 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-07-11 11:05:08 -0400
commit362951b9ec7139da43b0a72b6b80c06a67d05b04 (patch)
treec14780d8a16dcd93f43ba658f72654fcf740df36
parent193484798174ed012da634c0f3a4f8915c14ba2e (diff)
wrappercamerabinsrc: Fix caps filter caps proxying
The notify signal is triggered when caps is changed. But instead of proxying the fixed caps, we query for the caps. Hence, when we go to READY state, we endup setting template caps on the proxied caps filter instead of NULL, which leads to negoitation failure. Correctly proxy NULL caps if this is the new caps. Fixes not negotiated error when running in cheese. Also fix a leak of caps string in one of the trace. https://bugzilla.gnome.org/show_bug.cgi?id=732741
-rw-r--r--gst/camerabin2/gstwrappercamerabinsrc.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c
index 48ec28f23..a00785f1a 100644
--- a/gst/camerabin2/gstwrappercamerabinsrc.c
+++ b/gst/camerabin2/gstwrappercamerabinsrc.c
@@ -329,24 +329,19 @@ gst_wrapper_camera_src_src_event_probe (GstPad * pad, GstPadProbeInfo * info,
}
static void
-gst_wrapper_camera_bin_src_caps_cb (GObject * gobject, GParamSpec * pspec,
+gst_wrapper_camera_bin_src_caps_cb (GstPad * pad, GParamSpec * pspec,
gpointer user_data)
{
GstBaseCameraSrc *bcamsrc = GST_BASE_CAMERA_SRC (user_data);
GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (user_data);
- GstPad *src_caps_src_pad;
- GstCaps *caps = NULL;
+ GstCaps *caps;
GstStructure *in_st = NULL;
- /* get the new caps that were set on the capsfilter that configures the
- * source */
- src_caps_src_pad = gst_element_get_static_pad (self->src_filter, "src");
- caps = gst_pad_query_caps (src_caps_src_pad, NULL);
- gst_object_unref (src_caps_src_pad);
- GST_DEBUG_OBJECT (self, "src-filter caps changed to %s",
- gst_caps_to_string (caps));
+ caps = gst_pad_get_current_caps (pad);
+
+ GST_DEBUG_OBJECT (self, "src-filter caps changed to %" GST_PTR_FORMAT, caps);
- if (gst_caps_get_size (caps)) {
+ if (caps && gst_caps_get_size (caps)) {
in_st = gst_caps_get_structure (caps, 0);
if (in_st) {
gst_structure_get_int (in_st, "width", &bcamsrc->width);
@@ -365,13 +360,17 @@ gst_wrapper_camera_bin_src_caps_cb (GObject * gobject, GParamSpec * pspec,
GstCaps *filtercaps;
g_object_get (G_OBJECT (self->src_zoom_filter), "caps", &filtercaps, NULL);
- if (!gst_caps_is_equal (filtercaps, caps))
+
+ if (caps != filtercaps && (caps == NULL || filtercaps == NULL ||
+ !gst_caps_is_equal (filtercaps, caps)))
g_object_set (G_OBJECT (self->src_zoom_filter), "caps", caps, NULL);
- gst_caps_unref (filtercaps);
+
+ if (filtercaps)
+ gst_caps_unref (filtercaps);
}
- /* drop our ref on the caps */
- gst_caps_unref (caps);
+ if (caps)
+ gst_caps_unref (caps);
};
static void