commit:     3a1a9606ca0a32976c8290d7e6309efc4cb88cc6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  9 09:50:47 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun  9 09:51:17 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a1a9606

media-libs/gst-plugins-base: backport test (only) fix for glib-2.76

Thanks to Paolo Pedroni for testing. Backport requested upstream but unclear
if there'll be another 1.20.x. Already backported upstream to newer 1.22.x.

Closes: https://bugs.gentoo.org/907415
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../gst-plugins-base-1.20.6-libs_allocators.patch  | 75 ++++++++++++++++++++++
 .../gst-plugins-base-1.20.6.ebuild                 |  2 +-
 2 files changed, 76 insertions(+), 1 deletion(-)

diff --git 
a/media-libs/gst-plugins-base/files/gst-plugins-base-1.20.6-libs_allocators.patch
 
b/media-libs/gst-plugins-base/files/gst-plugins-base-1.20.6-libs_allocators.patch
new file mode 100644
index 000000000000..44e4c1d388a7
--- /dev/null
+++ 
b/media-libs/gst-plugins-base/files/gst-plugins-base-1.20.6-libs_allocators.patch
@@ -0,0 +1,75 @@
+https://bugs.gentoo.org/907415
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2487
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2480
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4422
+
+From a299399f5c93737bf963e34543578dba098b2f50 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <[email protected]>
+Date: Mon, 10 Apr 2023 16:06:19 +0200
+Subject: [PATCH] tests: allocators: Fix fdmem test with recent GLib
+
+The test failed with recent GLib, where `g_close` emits a critical
+warning on EBADF. Remove the `g_close` check from `test_fdmem` and add
+another version that tests `GST_FD_MEMORY_FLAG_DONT_CLOSE`.
+
+We will depend on the Valgrind test run to warn us about leaked FDs.
+
+Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2480
+Part-of: 
<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4422>
+--- a/tests/check/libs/allocators.c
++++ b/tests/check/libs/allocators.c
+@@ -95,7 +95,43 @@ GST_START_TEST (test_fdmem)
+   gst_memory_unmap (mem, &info);
+ 
+   gst_memory_unref (mem);
+-  fail_unless (g_close (fd, NULL) == 0);
++  gst_object_unref (alloc);
++}
++
++GST_END_TEST;
++
++GST_START_TEST (test_fdmem_dont_close)
++{
++  GstAllocator *alloc;
++  GstMemory *mem;
++  GstMapInfo info;
++  GError *error = NULL;
++  int fd;
++  const char *data = "0123456789";
++
++  fd = g_file_open_tmp (NULL, NULL, &error);
++  fail_if (error);
++  fail_unless (write (fd, data, 10) == 10);
++
++  alloc = gst_fd_allocator_new ();
++  fail_unless (alloc);
++  mem = gst_fd_allocator_alloc (alloc, fd, 10,
++      GST_FD_MEMORY_FLAG_KEEP_MAPPED | GST_FD_MEMORY_FLAG_DONT_CLOSE);
++
++  fail_unless (gst_memory_map (mem, &info, GST_MAP_READ));
++  fail_unless (info.data[5] == '5');
++  gst_memory_unmap (mem, &info);
++
++  fail_unless (gst_memory_map (mem, &info, GST_MAP_WRITE));
++  info.data[5] = 'X';
++  gst_memory_unmap (mem, &info);
++
++  fail_unless (gst_memory_map (mem, &info, GST_MAP_READ));
++  fail_unless (info.data[5] == 'X');
++  gst_memory_unmap (mem, &info);
++
++  gst_memory_unref (mem);
++  fail_unless (g_close (fd, NULL));
+   gst_object_unref (alloc);
+ }
+ 
+@@ -110,6 +146,7 @@ allocators_suite (void)
+   suite_add_tcase (s, tc_chain);
+   tcase_add_test (tc_chain, test_dmabuf);
+   tcase_add_test (tc_chain, test_fdmem);
++  tcase_add_test (tc_chain, test_fdmem_dont_close);
+ 
+   return s;
+ }
+-- 
+GitLab

diff --git a/media-libs/gst-plugins-base/gst-plugins-base-1.20.6.ebuild 
b/media-libs/gst-plugins-base/gst-plugins-base-1.20.6.ebuild
index b0cc01a91253..385496ed679e 100644
--- a/media-libs/gst-plugins-base/gst-plugins-base-1.20.6.ebuild
+++ b/media-libs/gst-plugins-base/gst-plugins-base-1.20.6.ebuild
@@ -93,8 +93,8 @@ DEPEND="${RDEPEND}
 
 DOCS=( AUTHORS NEWS README.md RELEASE )
 
-# Fixes backported to 1.20.1, to be removed in 1.20.2+
 PATCHES=(
+       "${FILESDIR}"/${P}-libs_allocators.patch
 )
 
 multilib_src_configure() {

Reply via email to