x11: handle case where no bufferpool is suggested
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 15 Jun 2012 14:43:47 +0000 (16:43 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 15 Jun 2012 14:45:16 +0000 (16:45 +0200)
sys/ximage/ximagesink.c
sys/xvimage/xvimagesink.c

index 21156a2..a1e9bf0 100644 (file)
@@ -1473,15 +1473,16 @@ gst_ximagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
     if (!gst_buffer_pool_set_config (pool, config))
       goto config_failed;
   }
-  /* we need at least 2 buffer because we hold on to the last one */
-  gst_query_add_allocation_pool (query, pool, size, 2, 0);
+  if (pool) {
+    /* we need at least 2 buffer because we hold on to the last one */
+    gst_query_add_allocation_pool (query, pool, size, 2, 0);
+    gst_object_unref (pool);
+  }
 
   /* we also support various metadata */
   gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
   gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE);
 
-  gst_object_unref (pool);
-
   return TRUE;
 
   /* ERRORS */
index 7fb457f..087ab54 100644 (file)
@@ -1984,15 +1984,16 @@ gst_xvimagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
     if (!gst_buffer_pool_set_config (pool, config))
       goto config_failed;
   }
-  /* we need at least 2 buffer because we hold on to the last one */
-  gst_query_add_allocation_pool (query, pool, size, 2, 0);
+  if (pool) {
+    /* we need at least 2 buffer because we hold on to the last one */
+    gst_query_add_allocation_pool (query, pool, size, 2, 0);
+    gst_object_unref (pool);
+  }
 
   /* we also support various metadata */
   gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
   gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE);
 
-  gst_object_unref (pool);
-
   return TRUE;
 
   /* ERRORS */