# GLcolorconvert and RTP raw payloder - performance issues

**URL:** <https://discourse.gstreamer.org/t/glcolorconvert-and-rtp-raw-payloder-performance-issues/3693>\
**Category:** General Discussion\
**Created:** [December 4, 2024, 3:56pm UTC](https://discourse.gstreamer.org/t/glcolorconvert-and-rtp-raw-payloder-performance-issues/3693 "2024-12-04T15:56:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpietek](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/jpietek/32/456_2.png) [@jpietek](https://discourse.gstreamer.org/u/jpietek)\
**Post date:** [December 4, 2024, 3:56pm UTC](https://discourse.gstreamer.org/t/glcolorconvert-and-rtp-raw-payloder-performance-issues/3693/1 "2024-12-04T15:56:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tpm](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tpm](https://discourse.gstreamer.org/u/tpm)\
**Post date:** [December 4, 2024, 6:08pm UTC](https://discourse.gstreamer.org/t/glcolorconvert-and-rtp-raw-payloder-performance-issues/3693/2 "2024-12-04T18:08:27Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![tpm](https://discourse.gstreamer.org/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tpm](https://discourse.gstreamer.org/u/tpm)\
**Post date:** [December 4, 2024, 6:09pm UTC](https://discourse.gstreamer.org/t/glcolorconvert-and-rtp-raw-payloder-performance-issues/3693/3 "2024-12-04T18:09:51Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![jpietek](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/jpietek/32/456_2.png) [@jpietek](https://discourse.gstreamer.org/u/jpietek)\
**Post date:** [December 9, 2024, 12:18pm UTC](https://discourse.gstreamer.org/t/glcolorconvert-and-rtp-raw-payloder-performance-issues/3693/4 "2024-12-09T12:18:43Z")

</div>

@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:

> <https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/rtp/gstrtpvrawpay.c#L577>

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?
