From 64ab9c5f7422ab157b175dde735d9d6943896129 Mon Sep 17 00:00:00 2001 From: Florian Egger Date: Mon, 7 Sep 2026 11:27:48 +0200 Subject: [PATCH] fix(render): use the correct SDL pixel format for FFmpeg RGBA DecodedFrame pixels are AV_PIX_FMT_RGBA (memory order R,G,B,A), but SDL names 32-bit formats MSB-first, so SDL_PIXELFORMAT_RGBA8888 reads memory as A,B,G,R: the opaque alpha byte was displayed as red and the image got a strong red tint. The correct constant is SDL_PIXELFORMAT_ABGR8888. Verified with solid red/green/blue synthetic RTP feeds through the real receiver: each hue now lands on its reference YUV values (red Y79/U87/V247, green Y148/U48/V27, blue Y34/U248/V108), where green previously displayed as magenta. --- src/render/sdl_renderer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/render/sdl_renderer.cpp b/src/render/sdl_renderer.cpp index d583dcc..772cdfb 100644 --- a/src/render/sdl_renderer.cpp +++ b/src/render/sdl_renderer.cpp @@ -7,9 +7,10 @@ namespace sc { namespace { -// DecodedFrame pixels are AV_PIX_FMT_RGBA: memory order R, G, B, A, which -// matches SDL_PIXELFORMAT_RGBA8888. -constexpr SDL_PixelFormat kSdlPixelFormat = SDL_PIXELFORMAT_RGBA8888; +// DecodedFrame pixels are AV_PIX_FMT_RGBA: memory order R, G, B, A. SDL +// names 32-bit formats MSB-first, so that byte order is SDL's ABGR8888 — +// using RGBA8888 would read the alpha byte as red and tint the image red. +constexpr SDL_PixelFormat kSdlPixelFormat = SDL_PIXELFORMAT_ABGR8888; class SdlRenderer final : public Renderer { public: