From 1c56e6564e4a65d3ce4b99cfd59bac42586513d4 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 3 Feb 2025 10:47:46 +0100 Subject: [PATCH] vdisp/sdl2: fixed I420 (IYUV) The pitch for planar pixel formats is the pitch of the first plane, most likely =width. This yield wrong data_len for I420 if just multiplied by the height. this fixes the change made by 107e3e30 (2024-09-02) --- src/video_display/sdl2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video_display/sdl2.c b/src/video_display/sdl2.c index 8394b27a6..3a7eb20b9 100644 --- a/src/video_display/sdl2.c +++ b/src/video_display/sdl2.c @@ -488,7 +488,9 @@ static bool recreate_textures(struct state_sdl2 *s, struct video_desc desc) { (void **) &f->tiles[0].data, &s->texture_pitch), return false); - f->tiles[0].data_len = desc.height * s->texture_pitch; + if (!codec_is_planar(desc.color_spec)) { + f->tiles[0].data_len = desc.height * s->texture_pitch; + } f->callbacks.data_deleter = vf_sdl_texture_data_deleter; simple_linked_list_append(s->free_frame_queue, f); }