diff -Nru gst-plugins-base1.0-1.20.1/debian/changelog gst-plugins-base1.0-1.20.1/debian/changelog --- gst-plugins-base1.0-1.20.1/debian/changelog 2022-03-14 22:45:53.000000000 +0800 +++ gst-plugins-base1.0-1.20.1/debian/changelog 2022-12-27 16:30:28.000000000 +0800 @@ -1,3 +1,11 @@ +gst-plugins-base1.0 (1.20.1-2) UNRELEASED; urgency=medium + + * Cherrypick from 3b900e1fa4fd888012dc005fa26ae2532a89b7a7. + buffer: drop parent meta in deep copy/foreach_metadata. + (LP: #1987631) + + -- Bin Li Tue, 27 Dec 2022 16:30:28 +0800 + gst-plugins-base1.0 (1.20.1-1) unstable; urgency=medium * New upstream bugfix release. diff -Nru gst-plugins-base1.0-1.20.1/debian/patches/0001-buffer-drop-parent-meta-in-deep-copy-foreach_metadat.patch gst-plugins-base1.0-1.20.1/debian/patches/0001-buffer-drop-parent-meta-in-deep-copy-foreach_metadat.patch --- gst-plugins-base1.0-1.20.1/debian/patches/0001-buffer-drop-parent-meta-in-deep-copy-foreach_metadat.patch 1970-01-01 08:00:00.000000000 +0800 +++ gst-plugins-base1.0-1.20.1/debian/patches/0001-buffer-drop-parent-meta-in-deep-copy-foreach_metadat.patch 2022-12-27 16:29:27.000000000 +0800 @@ -0,0 +1,87 @@ +From 3b900e1fa4fd888012dc005fa26ae2532a89b7a7 Mon Sep 17 00:00:00 2001 +From: Philipp Zabel +Date: Wed, 28 Mar 2018 17:54:15 +0200 +Subject: [PATCH] buffer: drop parent meta in deep copy/foreach_metadata + +The purpose of a deep buffer copy is to be able to release the source +buffer and all its dependencies. Attaching the parent buffer meta to +the newly created deep copy needlessly keeps holding a reference to the +parent buffer. + +The issue this solves is the fact you need to allocate more +buffers, as you have free buffers being held for no reason. In the good +cases it will use more memory, in the bad case it will stall your +pipeline (since codecs often need a minimum number of buffers to +actually work). + +Fixes #283 + +Part-of: +--- + .../gst-libs/gst/audio/gstaudiodecoder.c | 3 ++- + .../gst-libs/gst/audio/gstaudioencoder.c | 3 ++- + .../gst-libs/gst/video/gstvideodecoder.c | 3 ++- + .../gst-libs/gst/video/gstvideoencoder.c | 3 ++- + subprojects/gstreamer/gst/gstbuffer.c | 11 ++++++++++- + subprojects/gstreamer/gst/gstmeta.c | 3 +++ + subprojects/gstreamer/gst/gstmeta.h | 11 +++++++++++ + subprojects/gstreamer/libs/gst/base/gstadapter.c | 3 ++- + .../gstreamer/libs/gst/base/gstbasetransform.c | 6 ++++-- + 9 files changed, 38 insertions(+), 8 deletions(-) + +Index: gst-plugins-base1.0/gst-libs/gst/audio/gstaudiodecoder.c +=================================================================== +--- gst-plugins-base1.0.orig/gst-libs/gst/audio/gstaudiodecoder.c ++++ gst-plugins-base1.0/gst-libs/gst/audio/gstaudiodecoder.c +@@ -1245,7 +1245,8 @@ foreach_metadata (GstBuffer * inbuf, Gst + const GstMetaInfo *info = (*meta)->info; + gboolean do_copy = FALSE; + +- if (gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory)) { ++ if (gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory) ++ || gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory_reference)) { + /* never call the transform_meta with memory specific metadata */ + GST_DEBUG_OBJECT (decoder, "not copying memory specific metadata %s", + g_type_name (info->api)); +Index: gst-plugins-base1.0/gst-libs/gst/audio/gstaudioencoder.c +=================================================================== +--- gst-plugins-base1.0.orig/gst-libs/gst/audio/gstaudioencoder.c ++++ gst-plugins-base1.0/gst-libs/gst/audio/gstaudioencoder.c +@@ -706,7 +706,8 @@ foreach_metadata (GstBuffer * inbuf, Gst + const GstMetaInfo *info = (*meta)->info; + gboolean do_copy = FALSE; + +- if (gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory)) { ++ if (gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory) ++ || gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory_reference)) { + /* never call the transform_meta with memory specific metadata */ + GST_DEBUG_OBJECT (encoder, "not copying memory specific metadata %s", + g_type_name (info->api)); +Index: gst-plugins-base1.0/gst-libs/gst/video/gstvideodecoder.c +=================================================================== +--- gst-plugins-base1.0.orig/gst-libs/gst/video/gstvideodecoder.c ++++ gst-plugins-base1.0/gst-libs/gst/video/gstvideodecoder.c +@@ -3358,7 +3358,8 @@ foreach_metadata (GstBuffer * inbuf, Gst + const GstMetaInfo *info = (*meta)->info; + gboolean do_copy = FALSE; + +- if (gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory)) { ++ if (gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory) ++ || gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory_reference)) { + /* never call the transform_meta with memory specific metadata */ + GST_DEBUG_OBJECT (decoder, "not copying memory specific metadata %s", + g_type_name (info->api)); +Index: gst-plugins-base1.0/gst-libs/gst/video/gstvideoencoder.c +=================================================================== +--- gst-plugins-base1.0.orig/gst-libs/gst/video/gstvideoencoder.c ++++ gst-plugins-base1.0/gst-libs/gst/video/gstvideoencoder.c +@@ -2198,7 +2198,8 @@ foreach_metadata (GstBuffer * inbuf, Gst + const GstMetaInfo *info = (*meta)->info; + gboolean do_copy = FALSE; + +- if (gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory)) { ++ if (gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory) ++ || gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory_reference)) { + /* never call the transform_meta with memory specific metadata */ + GST_DEBUG_OBJECT (encoder, "not copying memory specific metadata %s", + g_type_name (info->api)); diff -Nru gst-plugins-base1.0-1.20.1/debian/patches/series gst-plugins-base1.0-1.20.1/debian/patches/series --- gst-plugins-base1.0-1.20.1/debian/patches/series 2022-01-28 22:59:31.000000000 +0800 +++ gst-plugins-base1.0-1.20.1/debian/patches/series 2022-12-27 16:29:27.000000000 +0800 @@ -0,0 +1 @@ +0001-buffer-drop-parent-meta-in-deep-copy-foreach_metadat.patch