From 11e15b437e7efc39e452f36e15a183225d6bfa39 Mon Sep 17 00:00:00 2001 From: Alexandre Acebedo Date: Mon, 2 Sep 2024 00:02:23 +0200 Subject: [PATCH] portals: application of the retries count in hlOnBufferDone (#255) --- src/portals/Screencopy.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/portals/Screencopy.cpp b/src/portals/Screencopy.cpp index 24d1443..48f951f 100644 --- a/src/portals/Screencopy.cpp +++ b/src/portals/Screencopy.cpp @@ -271,11 +271,17 @@ static void hlOnBufferDone(void* data, hyprland_toplevel_export_frame_v1* frame) PSESSION->sharingData.windowFrameCallback = nullptr; Debug::log(LOG, "[screencopy/pipewire] Out of buffers"); PSESSION->sharingData.status = FRAME_NONE; + if (PSESSION->sharingData.copyRetries++ < MAX_RETRIES) { + Debug::log(LOG, "[sc] Retrying screencopy ({}/{})", PSESSION->sharingData.copyRetries, MAX_RETRIES); + g_pPortalManager->m_sPortals.screencopy->m_pPipewire->updateStreamParam(PSTREAM); + g_pPortalManager->m_sPortals.screencopy->queueNextShareFrame(PSESSION); + } return; } hyprland_toplevel_export_frame_v1_copy(frame, PSTREAM->currentPWBuffer->wlBuffer, false); - + PSESSION->sharingData.copyRetries = 0; + Debug::log(TRACE, "[sc] wlr frame copied"); }