From 716da5e0f3756df9ad0edf948e10d80aecf9019b Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 20 Nov 2023 18:50:48 +0000 Subject: [PATCH] screenshare: destroy bo on pwStreamRemoveBuffer --- src/portals/Screencopy.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/portals/Screencopy.cpp b/src/portals/Screencopy.cpp index ba897fd..afd36cd 100644 --- a/src/portals/Screencopy.cpp +++ b/src/portals/Screencopy.cpp @@ -932,6 +932,9 @@ static void pwStreamRemoveBuffer(void* data, pw_buffer* buffer) { if (PSTREAM->currentPWBuffer == PBUFFER) PSTREAM->currentPWBuffer = nullptr; + if (PBUFFER->isDMABUF) + gbm_bo_destroy(PBUFFER->bo); + wl_buffer_destroy(PBUFFER->wlBuffer); for (int plane = 0; plane < PBUFFER->planeCount; plane++) { close(PBUFFER->fd[plane]); @@ -1075,7 +1078,7 @@ uint32_t CPipewireConnection::buildFormatsFor(spa_pod_builder* b[2], const spa_p paramCount = 2; params[0] = build_format(b[0], pwFromDrmFourcc(stream->pSession->sharingData.frameInfoDMA.fmt), stream->pSession->sharingData.frameInfoDMA.w, - stream->pSession->sharingData.frameInfoDMA.h, stream->pSession->sharingData.framerate, modifiers, modCount); + stream->pSession->sharingData.frameInfoDMA.h, stream->pSession->sharingData.framerate, modifiers, modCount); assert(params[0] != NULL); params[1] = build_format(b[1], pwFromDrmFourcc(stream->pSession->sharingData.frameInfoSHM.fmt), stream->pSession->sharingData.frameInfoSHM.w, stream->pSession->sharingData.frameInfoSHM.h, stream->pSession->sharingData.framerate, NULL, 0); @@ -1085,7 +1088,7 @@ uint32_t CPipewireConnection::buildFormatsFor(spa_pod_builder* b[2], const spa_p paramCount = 1; params[0] = build_format(b[0], pwFromDrmFourcc(stream->pSession->sharingData.frameInfoSHM.fmt), stream->pSession->sharingData.frameInfoSHM.w, - stream->pSession->sharingData.frameInfoSHM.h, stream->pSession->sharingData.framerate, NULL, 0); + stream->pSession->sharingData.frameInfoSHM.h, stream->pSession->sharingData.framerate, NULL, 0); } if (modifiers)