diff options
| author | Robert Mader <robert.mader@collabora.com> | 2025-10-12 20:54:18 +0200 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2025-11-15 09:55:43 -0500 |
| commit | afcc2f4037bcb7b63c04ce12600ccfd360e75719 (patch) | |
| tree | 48dc709f2b0851015fb29800ea55b188f21da657 | |
| parent | bdb7e39ab5077de6ea21eb3925b8ae6ffa0f5009 (diff) | |
rtp: device: Ensure even heights for rescaled streams
Odd heights, while generally handled by Gstreamer, can cause issues in
various places - most importantly hardware video en-/decoders and
GL/VK drivers - as in most cases 2x0 or 2x2 subsampled intermediate
pixel formats are used (such as I420, YUYV, NV12 etc.).
Thus ensure we always end up with an even height.
| -rw-r--r-- | plugins/rtp/src/device.vala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/rtp/src/device.vala b/plugins/rtp/src/device.vala index 160cadc0..bdb597b6 100644 --- a/plugins/rtp/src/device.vala +++ b/plugins/rtp/src/device.vala @@ -218,6 +218,9 @@ public class Dino.Plugins.Rtp.Device : MediaDevice, Object { } if (new_width == active_caps_width) return; int new_height = device_caps_height * new_width / device_caps_width; + if ((new_height % 2) != 0) { + new_height += 1; + } Gst.Caps new_caps; if (device_caps_framerate_den != 0) { new_caps = new Gst.Caps.simple("video/x-raw", "width", typeof(int), new_width, "height", typeof(int), new_height, "framerate", typeof(Gst.Fraction), device_caps_framerate_num, device_caps_framerate_den, null); |
