Skip to content

pipewire: fix image format conversion

Tobias Junghans requested to merge junghans/krfb:master into master

According to the docs, QImage::convertTo() performs an in-place format conversion after detaching, i.e. it does not operate on the buffer passed to its constructor (which wouldn't even work if a larger buffer is required for the target format). Therefore two flaws in the current implementation need to be fixed:

  • memcpy() has to copy the converted image data to the target buffer
  • the target format should always be QImage::Format_RGBX8888 according to the return value of PWFrameBuffer::depth() - only streams in SPA_VIDEO_FORMAT_RGBx format can be copied directly.

This fixes wrong colors in my setup (QEMU VM with Debian Testing and Gnome) where the PipeWire stream is supplied in SPA_VIDEO_FORMAT_BGRx format.

Edited by Tobias Junghans

Merge request reports