mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 14:35:57 +01:00
screencast: guard pipewire stream validity for queue
This commit is contained in:
parent
c23f738673
commit
f5c3576c3b
1 changed files with 12 additions and 1 deletions
|
@ -46,7 +46,8 @@ static void wlrOnReady(void* data, zwlr_screencopy_frame_v1* frame, uint32_t tv_
|
|||
|
||||
g_pPortalManager->m_sPortals.screencopy->m_pPipewire->enqueue(PSESSION);
|
||||
|
||||
g_pPortalManager->m_sPortals.screencopy->queueNextShareFrame(PSESSION);
|
||||
if (g_pPortalManager->m_sPortals.screencopy->m_pPipewire->streamFromSession(PSESSION))
|
||||
g_pPortalManager->m_sPortals.screencopy->queueNextShareFrame(PSESSION);
|
||||
|
||||
zwlr_screencopy_frame_v1_destroy(frame);
|
||||
PSESSION->sharingData.frameCallback = nullptr;
|
||||
|
@ -1118,6 +1119,11 @@ CPipewireConnection::SPWStream* CPipewireConnection::streamFromSession(CScreenco
|
|||
void CPipewireConnection::enqueue(CScreencopyPortal::SSession* pSession) {
|
||||
const auto PSTREAM = streamFromSession(pSession);
|
||||
|
||||
if (!PSTREAM) {
|
||||
Debug::log(ERR, "[pw] Attempted enqueue on invalid session??");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug::log(TRACE, "[pw] enqueue on {}", (void*)PSTREAM);
|
||||
|
||||
if (!PSTREAM->currentPWBuffer) {
|
||||
|
@ -1202,6 +1208,11 @@ void CPipewireConnection::enqueue(CScreencopyPortal::SSession* pSession) {
|
|||
void CPipewireConnection::dequeue(CScreencopyPortal::SSession* pSession) {
|
||||
const auto PSTREAM = streamFromSession(pSession);
|
||||
|
||||
if (!PSTREAM) {
|
||||
Debug::log(ERR, "[pw] Attempted dequeue on invalid session??");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug::log(TRACE, "[pw] dequeue on {}", (void*)PSTREAM);
|
||||
|
||||
const auto PWBUF = pw_stream_dequeue_buffer(PSTREAM->stream);
|
||||
|
|
Loading…
Reference in a new issue