From 4414271a0263fdd82e943c4430131a265d5fba13 Mon Sep 17 00:00:00 2001
From: Rafael Caricio <rafael@caricio.com>
Date: Tue, 30 Aug 2022 14:29:41 +0200
Subject: [PATCH] audiovisualizer: fix buffer mapping to not increase refcount

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2987>
---
 .../gst-plugins-base/gst-libs/gst/pbutils/gstaudiovisualizer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstaudiovisualizer.c b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstaudiovisualizer.c
index b8cefd914c..6e4fc0cfc9 100644
--- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstaudiovisualizer.c
+++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/gstaudiovisualizer.c
@@ -1168,7 +1168,8 @@ gst_audio_visualizer_chain (GstPad * pad, GstObject * parent,
     if (!(adata = (gpointer) gst_adapter_map (scope->priv->adapter, sbpf)))
       break;
 
-    gst_video_frame_map (&outframe, &scope->vinfo, outbuf, GST_MAP_READWRITE);
+    gst_video_frame_map (&outframe, &scope->vinfo, outbuf,
+        GST_MAP_READWRITE | GST_VIDEO_FRAME_MAP_FLAG_NO_REF);
 
     if (scope->priv->shader) {
       gst_video_frame_copy (&outframe, &scope->priv->tempframe);