Fix a buffer offset problem in GStreamer 1.16. Initially reported by Mark H. Weaver in . See also . From 1734c9fc1a4f99b165383ae1eb02f04e0844a00c Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Sat, 29 Jun 2019 09:22:05 -0400 Subject: [PATCH] bufferpool: Fix the buffer size reset code The offset in gst_buffer_resize() is additive. So to move back the offset to zero, we need to pass the opposite of the current offset. This was raised through the related unit test failingon 32bit as on 64bit the alignment padding was enough to hide the issue. The test was modified to also fail on 64bit. This patch will remove spurious assertions like: assertion 'bufmax >= bufoffs + offset + size' failed Fixes #316 --- gst/gstbufferpool.c | 7 +++++-- tests/check/gst/gstbufferpool.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c index e5c7a5872..619860e63 100644 --- a/gst/gstbufferpool.c +++ b/gst/gstbufferpool.c @@ -1222,8 +1222,11 @@ default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer) GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE; /* if the memory is intact reset the size to the full size */ - if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_TAG_MEMORY)) - gst_buffer_resize (buffer, 0, pool->priv->size); + if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_TAG_MEMORY)) { + gsize offset; + gst_buffer_get_sizes (buffer, &offset, NULL); + gst_buffer_resize (buffer, -offset, pool->priv->size); + } /* remove all metadata without the POOLED flag */ gst_buffer_foreach_meta (buffer, remove_meta_unpooled, pool); diff --git a/tests/check/gst/gstbufferpool.c b/tests/check/gst/gstbufferpool.c index f0c3c8d8e..dd9b2dc03 100644 --- a/tests/check/gst/gstbufferpool.c +++ b/tests/check/gst/gstbufferpool.c @@ -190,7 +190,7 @@ GST_START_TEST (test_buffer_modify_discard) gst_buffer_pool_acquire_buffer (pool, &buf, NULL); buffer_track_destroy (buf, &dcount); /* do resize, as we didn't modify the memory, pool should reuse this buffer */ - gst_buffer_resize (buf, 5, 2); + gst_buffer_resize (buf, 8, 2); gst_buffer_unref (buf); /* buffer should've gone back into pool */ -- 2.22.0 >Expand)Author 2021-12-19home: Add gexp-compiler for home-environments....* gnu/home.scm (home-environment-compiler): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Andrew Tropin 2021-10-09Move (gnu home-services) to (gnu home services)....* gnu/home-services.scm (%guix-home-root-directory): Replace gnu/home-services.scm with "gnu/home/services.scm". Rename to gnu/home/services.scm. * gnu/local.mk (GNU_SYSTEM_MODULES): Rename gnu/home-services.scm to gnu/home/services.scm. * doc/he-config-bare-bones.scm: Replace (gnu home-services) with (gnu home services). * gnu/home.scm: Same. * gnu/home/services/fontutils.scm: Same. * gnu/home/services/mcron.scm: Same. * gnu/home/services/shells.scm: Same. * gnu/home/services/shepherd.scm: Same. * gnu/home/services/symlink-manager.scm: Same. * gnu/home/services/xdg.scm: Same. * guix/scripts/home.scm: Same. * guix/self.scm: Same. Oleg Pykhalov 2021-10-08gnu: Move (gnu home-services) to (gnu home services)....* gnu/home-services/configuration.scm: Move the content ... * gnu/home/services/configuration.scm: ... here. * doc/guix.texi: Replace (gnu home-services mcron) with (gnu home services mcron). Replace (gnu home-services) with (gnu home services). * gnu/home.scm: Replace (gnu home-services fontutils) with (gnu services fontutils). Replace (gnu home-services shells) with (gnu home services shells). Replace (gnu home-services symlink-manager) with (gnu home services symlink-manager). Replace (gnu home-services xdg) with (gnu home services xdg). * gnu/home-services/fontutils.scm: Rename to gnu/services/fontutils.scm. * gnu/home-services/mcron.scm: Move to gnu/home/services/mcron.scm. Replace (gnu home-services shepherd) with (gnu home services shepherd). * gnu/home-services.scm (%service-type-path): Search home services in "gnu/services". * gnu/home-services/shells.scm: Replace (gnu home-services configuration) with (gnu home services configuration). Rename to gnu/home/services/shells.scm. Replace (gnu home-services utils) with (gnu home services utils). * gnu/home-services/shepherd.scm: Move to gnu/home/services/shepherd.scm. * gnu/home-services/symlink-manager.scm: Rename to gnu/home/services/symlink-manager.scm. * gnu/home-services/utils.scm: Rename to gnu/home/services/utils.scm. * gnu/home-services/xdg.scm: Rename to gnu/home/services/xdg.scm. * guix/scripts/home/import.scm: Replace (gnu home-services bash) with (gnu home services bash). * gnu/home-services.scm: Update documentation string. * doc/he-config-bare-bones.scm: Apply new (gnu home-services ...) modules location. * gnu/local.mk (GNU_SYSTEM_MODULES): Same. Oleg Pykhalov 2021-09-09gnu: home: Add doc comment about the module....Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com> Andrew Tropin 2021-09-09home: Add home-environment....* gnu/home.scm (home-environment, home-environment?, this-home-environment) (home-environment-derivation, home-environment-user-services) (home-environment-essential-services, home-environment-services) (home-environment-location, home-environment-with-provenance): New variables. * gnu/local.mk (GNU_SYSTEM_MODULES): Add home.scm. Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com> Andrew Tropin