GLcolorconvert and RTP raw payloder - performance issues

Hi,

I have a Gstreamer app that has appsrc input with GLMemory RGBA buffers taken from libobs based video mixer.

The pipeline I’m trying to run should convert those buffers to YUV422 and send them over R(C)TP. With the CPU-based pixel format conversion it’s fine:

gldownload ! videoconvert ! video/x-raw,width=1920,height=1080,framerate=60/1,format=UYVY ! rtpvrawpay ! udpsink

The problem starts at 4K60fps when I try to use glcolorconvert to speed up pixfmt conversion and not push raw RGBA over PCI-Express bus.

glcolorconvert ! video/x-raw(memory:GLMemory),width=3840,height=2160,framerate=60/1,format=UYVY ! gldownload ! rtpvrawpay ! udpsink

This leads to huge number of frames accumulating at the RTP payloader. Adding a leaky queue can make it run, but the framerate is only a few fps.

The question is as always: why?! After glcolorconvert the buffers have GstGLSyncMeta attached. Maybe this is problematic for the RTP payloader. Removing those metadata might help? Any hints or tips appreciated.

cheers,
Jan

Couple of things you could try:

  • add a queue max-size-bytes=0 max-size-time=0 max-size-buffers=5 before and after the rtpvrawpay
  • use a higher rtpvrawpay chunks-per-frame=X than the default (shouldn’t change overall cpu usage, just gets out data quicker and might lubricate things a little by sending smaller chunks at a time)
  • increase the kernel send buffer size with e.g. sudo sysctl net.core.wmem_max=67108864 (might be excessive, but the default is very very low) and then use a higher value with udpsink buffer-size=X (won’t change cpu usage, but makes packet loss through “lumpy scheduling of data to send out” less likely)

Also, videoconvert has an n-threads property which can be set to a non-1 value to parallelise the conversion, which might help push through frames on time with software conversion (depends on your CPU ofc).

@tpm many thanks for the hints. I’ve tuned the tcp stack and udpsink buffer-size, bumped payloader chunks-per-frame, but it was not (only) the case. Even with fakesink the payloader was still lagging.

What - did - help was commenting out this line:

So seems like GstGLSyncMeta was the problem? I don’t understand why after gldownload it is still there? I would assume that for the payloader passing anything related to the OpenGL context makes no sense?