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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user