Commit 3afcdb2a authored by Carson Black's avatar Carson Black 🍿

Return buffer to pipewire when returning early from recordFrame

Summary: Even when something goes wrong, the buffer should be returned to pipewire for recycling on next frame.

Test Plan:
Before: when something goes wrong when screencasting, first errors are the actual issue and subsequent errors are due to pipewire not having any buffers for the pw_stream_deque_buffer call
After: when something goes wrong when screencasting, errors are always the actual issue

Reviewers: #plasma, jgrulich

Reviewed By: jgrulich

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28713
parent 4cb8ca2c
......@@ -528,6 +528,7 @@ bool ScreenCastStream::recordFrame(gbm_bo *bo, quint32 width, quint32 height, qu
if (!(data = (uint8_t *) spa_buffer->datas[0].data)) {
qCWarning(XdgDesktopPortalKdeScreenCastStream) << "Failed to record frame: invalid buffer data";
pw_stream_queue_buffer(pwStream, buffer);
return false;
}
......@@ -537,6 +538,7 @@ bool ScreenCastStream::recordFrame(gbm_bo *bo, quint32 width, quint32 height, qu
if (destSize != srcSize || stride != destStride) {
qCWarning(XdgDesktopPortalKdeScreenCastStream) << "Failed to record frame: different stride";
pw_stream_queue_buffer(pwStream, buffer);
return false;
}
......@@ -548,6 +550,7 @@ bool ScreenCastStream::recordFrame(gbm_bo *bo, quint32 width, quint32 height, qu
if (image == EGL_NO_IMAGE_KHR) {
qCWarning(XdgDesktopPortalKdeScreenCastStream) << "Failed to record frame: Error creating EGLImageKHR - " << WaylandIntegration::formatGLError(glGetError());
pw_stream_queue_buffer(pwStream, buffer);
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment