summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2021-05-22 18:54:49 +0100
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-06-02 12:40:14 +0000
commit26143333899382035e66f0360019c67d4a252e78 (patch)
tree87f44b6a353fd6523d5325492060b6357c0222bd
parentf3dcdfbd606d0c4cd1e7e12872d21d36919c043e (diff)
downloadgstreamer-vaapi-26143333899382035e66f0360019c67d4a252e78.tar.gz
Use g_memdup2() where available and add fallback for older GLib versions
Alloc size is based on existing allocations and struct sizes. g_memdup() is deprecated since GLib 2.68 and we want to avoid deprecation warnings with recent versions of GLib. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/431>
-rw-r--r--gst-libs/gst/vaapi/gstvaapifilter.c2
-rw-r--r--meson.build4
2 files changed, 5 insertions, 1 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapifilter.c b/gst-libs/gst/vaapi/gstvaapifilter.c
index e0b3cd5f..675c481b 100644
--- a/gst-libs/gst/vaapi/gstvaapifilter.c
+++ b/gst-libs/gst/vaapi/gstvaapifilter.c
@@ -671,7 +671,7 @@ op_data_ensure_caps (GstVaapiFilterOpData * op_data, gpointer filter_caps,
return FALSE;
}
- op_data->va_caps = g_memdup (filter_cap, op_data->va_cap_size * va_num_caps);
+ op_data->va_caps = g_memdup2 (filter_cap, op_data->va_cap_size * va_num_caps);
if (!op_data->va_caps)
return FALSE;
diff --git a/meson.build b/meson.build
index 5c4a8dfa..85ca2469 100644
--- a/meson.build
+++ b/meson.build
@@ -208,6 +208,10 @@ if gst_version_nano == 0
endif
endif
+if gmodule_dep.version().version_compare('< 2.67.4')
+ cdata.set('g_memdup2(ptr,sz)', '(G_LIKELY(((guint64)(sz)) < G_MAXUINT)) ? g_memdup(ptr,sz) : (g_abort(),NULL)')
+endif
+
configure_file(output: 'config.h', configuration: cdata)
python3 = import('python').find_installation()