Two fixes. The first sets inited to TRUE when we're going into passthrough mode ...
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Mon, 10 Nov 2003 13:56:25 +0000 (13:56 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Mon, 10 Nov 2003 13:56:25 +0000 (13:56 +0000)
Original commit message from CVS:
Two fixes. The first sets inited to TRUE when we're going into passthrough mode (else, capsnego succeeds and the chain() function warns that inited != TRUE), and the second check for validity of caps on src side that were entered on sink side before applying. Else, caps1 could be NULL which causes a segfault.

gst/videoscale/gstvideoscale.c

index fee0f8b..9cdc3d4 100644 (file)
@@ -330,6 +330,7 @@ gst_videoscale_sink_link (GstPad *pad, GstCaps *caps)
   ret = gst_pad_try_set_caps (videoscale->srcpad, gst_caps_copy(caps));
   if (ret == GST_PAD_LINK_OK || ret == GST_PAD_LINK_DONE) {
     videoscale->passthru = TRUE;
+    videoscale->inited = TRUE;
     return ret;
   }
 
@@ -342,6 +343,12 @@ gst_videoscale_sink_link (GstPad *pad, GstCaps *caps)
   peercaps = gst_pad_get_allowed_caps(videoscale->srcpad);
 
   caps1 = gst_caps_intersect(peercaps, srccaps);
+  if (!caps1) {
+    /* apparently, the sink element doesn't like the input of the
+     * source element. The user should add a colorspace converter
+     * or so. */
+    return GST_PAD_LINK_REFUSED;
+  }
 
   if (!GST_CAPS_IS_FIXED (caps1)) {
     /* FIXME */