summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Quaresma <quaresma.jose@gmail.com>2020-11-07 11:05:06 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-11-20 10:53:21 +0000
commit411f54128841d8d365dc6a36d2ea7b1abc55ee02 (patch)
tree10bf6151e40ad5da4e9c4da86cc416d783c135c0
parent83477f0280011e86f346ef7c1ea16780899e7805 (diff)
downloadpoky-411f54128841d8d365dc6a36d2ea7b1abc55ee02.tar.gz
gstreamer1.0: warn the user when something is wrong with GstBufferPool
This is not a critical bug fix but it can be usefull in some BSP with exotic drivers like on nvidia tegra bsp. (From OE-Core rev: b53a89f4e5457689b7cb38ed9b3d0885cfd47c12) Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-bufferpool-only-resize-in-reset-when-maxsize-is-larger.patch49
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb1
2 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-bufferpool-only-resize-in-reset-when-maxsize-is-larger.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-bufferpool-only-resize-in-reset-when-maxsize-is-larger.patch
new file mode 100644
index 0000000000..dacc399d28
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-bufferpool-only-resize-in-reset-when-maxsize-is-larger.patch
@@ -0,0 +1,49 @@
1From a1b41b2b2493069365a8274c6a544e6799a5a8df Mon Sep 17 00:00:00 2001
2From: Matthew Waters <matthew@centricular.com>
3Date: Mon, 20 Jul 2020 17:08:32 +1000
4Subject: [PATCH] gst/bufferpool: only resize in reset when maxsize is larger
5
6Only resize the buffer if the maxsize is larger then the configued pool
7size.
8
9Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/570>
10
11Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/a1b41b2b2493069365a8274c6a544e6799a5a8df]
12
13Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
14---
15 gst/gstbufferpool.c | 18 +++++++++++++++---
16 1 file changed, 15 insertions(+), 3 deletions(-)
17
18diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c
19index 8ae868cf2c7..a8167d017d6 100644
20--- a/gst/gstbufferpool.c
21+++ b/gst/gstbufferpool.c
22@@ -1223,9 +1223,21 @@ default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer)
23
24 /* if the memory is intact reset the size to the full size */
25 if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_TAG_MEMORY)) {
26- gsize offset;
27- gst_buffer_get_sizes (buffer, &offset, NULL);
28- gst_buffer_resize (buffer, -offset, pool->priv->size);
29+ gsize offset, maxsize;
30+ gst_buffer_get_sizes (buffer, &offset, &maxsize);
31+ /* check if we can resize to at least the pool configured size. If not,
32+ * then this will fail internally in gst_buffer_resize().
33+ * default_release_buffer() will drop the buffer from the pool if the
34+ * sizes don't match */
35+ if (maxsize >= pool->priv->size) {
36+ gst_buffer_resize (buffer, -offset, pool->priv->size);
37+ } else {
38+ GST_WARNING_OBJECT (pool, "Buffer %p without the memory tag has "
39+ "maxsize (%" G_GSIZE_FORMAT ") that is smaller than the "
40+ "configured buffer pool size (%u). The buffer will be not be "
41+ "reused. This is most likely a bug in this GstBufferPool subclass",
42+ buffer, maxsize, pool->priv->size);
43+ }
44 }
45
46 /* remove all metadata without the POOLED flag */
47--
48GitLab
49
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb
index 66ad3e3381..7afe56cd7b 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.16.3.bb
@@ -21,6 +21,7 @@ SRC_URI = " \
21 file://0002-meson-build-gir-even-when-cross-compiling-if-introsp.patch \ 21 file://0002-meson-build-gir-even-when-cross-compiling-if-introsp.patch \
22 file://0003-meson-Add-valgrind-feature.patch \ 22 file://0003-meson-Add-valgrind-feature.patch \
23 file://0004-meson-Add-option-for-installed-tests.patch \ 23 file://0004-meson-Add-option-for-installed-tests.patch \
24 file://0005-bufferpool-only-resize-in-reset-when-maxsize-is-larger.patch \
24" 25"
25SRC_URI[md5sum] = "beecf6965a17fb17fa3b262fd36df70a" 26SRC_URI[md5sum] = "beecf6965a17fb17fa3b262fd36df70a"
26SRC_URI[sha256sum] = "692f037968e454e508b0f71d9674e2e26c78475021407fcf8193b1c7e59543c7" 27SRC_URI[sha256sum] = "692f037968e454e508b0f71d9674e2e26c78475021407fcf8193b1c7e59543c7"