gst/audioconvert/gstaudioconvert.c: Test that pad is negotiated before getting its...
authorDavid Schleef <ds@schleef.org>
Mon, 12 Jan 2004 18:59:57 +0000 (18:59 +0000)
committerDavid Schleef <ds@schleef.org>
Mon, 12 Jan 2004 18:59:57 +0000 (18:59 +0000)
Original commit message from CVS:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_link):
Test that pad is negotiated before getting its caps.

ChangeLog
gst/audioconvert/gstaudioconvert.c

index 63d900d..58fe746 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-12  David Schleef  <ds@schleef.org>
+
+       * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_link):
+       Test that pad is negotiated before getting its caps.
+
 2004-01-12  Julien MOUTTE <julien@moutte.net>
 
        * gst-libs/gst/play/gstplay.c: (gst_play_get_sink_element): When
index 7461f64..c2e6801 100644 (file)
@@ -406,14 +406,16 @@ gst_audio_convert_link (GstPad *pad, const GstCaps *caps)
     GstPadLinkReturn ret;
     
     otherpad = (nr) ? this->src : this->sink;
-    othercaps = gst_caps_copy (gst_pad_get_negotiated_caps (otherpad));
+    if (gst_pad_is_negotiated (otherpad)) {
+      othercaps = gst_caps_copy (gst_pad_get_negotiated_caps (otherpad));
 
-    gst_caps_set_simple (othercaps, "rate", G_TYPE_INT, rate, NULL);
+      gst_caps_set_simple (othercaps, "rate", G_TYPE_INT, rate, NULL);
 
-    ret = gst_pad_try_set_caps (otherpad, othercaps);
-    if (GST_PAD_LINK_FAILED (ret)) return ret;
+      ret = gst_pad_try_set_caps (otherpad, othercaps);
+      if (GST_PAD_LINK_FAILED (ret)) return ret;
 
-    this->rate[1 - nr] = rate;
+      this->rate[1 - nr] = rate;
+    }
   }
 
   this->caps_set[nr] = TRUE;