mirror of
https://invent.kde.org/network/krfb
synced 2024-07-01 07:24:29 +00:00
pw: Improve fb allocation code.
Don't set the video size using the data coming from xdp, instead use the data coming from pipewire, which is what matters. Also make sure setVideoSize is called before using the buffer rather than after.
This commit is contained in:
parent
2995637d27
commit
378472f8b2
|
@ -334,7 +334,6 @@ void PWFrameBuffer::Private::handleRemoteDesktopStarted(quint32 code, const QVar
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setVideoSize(qdbus_cast<QSize>(streams.first().map[QStringLiteral("size")].value<QDBusArgument>()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PWFrameBuffer::Private::handleFrame(const PipeWireFrame &frame)
|
void PWFrameBuffer::Private::handleFrame(const PipeWireFrame &frame)
|
||||||
|
@ -348,17 +347,20 @@ void PWFrameBuffer::Private::handleFrame(const PipeWireFrame &frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame.dataFrame) {
|
if (frame.dataFrame) {
|
||||||
memcpy(q->fb, frame.dataFrame->data, frame.dataFrame->size.width() * frame.dataFrame->stride);
|
// FIXME: Assuming stride == width * 4, not sure to which extent this holds
|
||||||
setVideoSize(frame.dataFrame->size);
|
setVideoSize(frame.dataFrame->size);
|
||||||
|
memcpy(q->fb, frame.dataFrame->data, frame.dataFrame->size.width() * frame.dataFrame->stride);
|
||||||
}
|
}
|
||||||
else if (frame.dmabuf) {
|
else if (frame.dmabuf) {
|
||||||
QImage src((uchar*) q->fb, videoSize.width(), videoSize.height(), QImage::Format_RGB32);
|
// FIXME: Assuming stride == width * 4, not sure to which extent this holds
|
||||||
|
const QSize size = { frame.dmabuf->width, frame.dmabuf->height };
|
||||||
|
setVideoSize(size);
|
||||||
|
QImage src(reinterpret_cast<uchar*>(q->fb), size.width(), size.height(), QImage::Format_RGB32);
|
||||||
if (!m_dmabufHandler.downloadFrame(src, frame)) {
|
if (!m_dmabufHandler.downloadFrame(src, frame)) {
|
||||||
stream->renegotiateModifierFailed(frame.format, frame.dmabuf->modifier);
|
stream->renegotiateModifierFailed(frame.format, frame.dmabuf->modifier);
|
||||||
qCDebug(KRFB_FB_PIPEWIRE) << "Failed to download frame.";
|
qCDebug(KRFB_FB_PIPEWIRE) << "Failed to download frame.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setVideoSize(src.size());
|
|
||||||
} else {
|
} else {
|
||||||
qCDebug(KRFB_FB_PIPEWIRE) << "Unknown kind of frame";
|
qCDebug(KRFB_FB_PIPEWIRE) << "Unknown kind of frame";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user