summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2018-01-29 12:53:51 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2018-01-31 14:18:33 +0100
commitb8ef897d0847d4abdd2855cde25ef8db0aae4d01 (patch)
tree20b1ff609096396149f1f39b7cc803b43141a5e3
parent198b3703e295ae415b5853c563a143ae805ef86c (diff)
downloadgstreamer-plugins-bad-b8ef897d0847d4abdd2855cde25ef8db0aae4d01.tar.gz
gdpdepay: don't use allocator if it has custom alloc
gdpdepay element uses the decide_allocation to fetch the downstream allocator. Nonetheless it is possible that allocate uses a custom alloc function, which is not usable by gdpdepay, crashing later the application when the allocater buffer is NULL. This patch checks for the allocator flags and reset it if the allocator has a custom alloc function. https://bugzilla.gnome.org/show_bug.cgi?id=789476
-rw-r--r--gst/gdp/gstgdpdepay.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gst/gdp/gstgdpdepay.c b/gst/gdp/gstgdpdepay.c
index 750571e6f..f00f3d6f1 100644
--- a/gst/gdp/gstgdpdepay.c
+++ b/gst/gdp/gstgdpdepay.c
@@ -580,6 +580,15 @@ gst_gdp_depay_decide_allocation (GstGDPDepay * gdpdepay)
if (gdpdepay->allocator)
gst_object_unref (gdpdepay->allocator);
+ if (allocator &&
+ GST_OBJECT_FLAG_IS_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC)) {
+ GST_DEBUG_OBJECT (gdpdepay,
+ "Provided allocator has a custom alloc fuction. Ignoring.");
+ gst_object_unref (allocator);
+ allocator = NULL;
+ gst_allocation_params_init (&params);
+ }
+
gdpdepay->allocator = allocator;
gdpdepay->allocation_params = params;