pulse: Get caps correctly on pad block
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Tue, 18 Oct 2011 13:01:17 +0000 (18:31 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Tue, 18 Oct 2011 14:32:55 +0000 (20:02 +0530)
Instead of always going upstream, we should first see if already got
caps from a setcaps() call.

https://bugzilla.gnome.org/show_bug.cgi?id=661262

ext/pulse/pulseaudiosink.c

index b7e1a07..bfd5483 100644 (file)
@@ -653,7 +653,14 @@ proxypad_blocked_cb (GstPad * pad, gboolean blocked, gpointer data)
 
   if (!pbin->format_lost) {
     sinkpad = gst_element_get_static_pad (GST_ELEMENT (pbin->psink), "sink");
-    caps = gst_pad_get_caps_reffed (pad);
+
+    if (GST_PAD_CAPS (pbin->sinkpad)) {
+      /* See if we already got caps on our sinkpad */
+      caps = gst_caps_ref (GST_PAD_CAPS (pbin->sinkpad));
+    } else {
+      /* We haven't, so get caps from upstream */
+      caps = gst_pad_get_caps_reffed (pad);
+    }
 
     if (gst_pad_accept_caps (sinkpad, caps)) {
       if (pbin->dbin2) {