Use NV12 pixel format on SDL

I have a Gstreamer pipeline and I don’t want to use any pixel conversion, so what I have is the NV12 format.
I’m using appSync to get the buffer

However the SDL texture has the following spec:

int SDL_UpdateTexture(SDL_Texture * texture,
                      const SDL_Rect * rect,
                      const void *pixels, int pitch);

Where pitch is: the number of bytes in a row of pixel data, including padding between lines

How do I calculate the pitch? I thought that it woul be widtth * 2, but I’m getting a segmention fault on my embedded device.

Thank you

Not sure for your SDL case, but my understanding of pitch is it would be the size able to store your frame width when aligned to stride blocks.
Try with 256 bytes strides. For example a frame with width 512 would use 2 strides per row and use pitch 512. A frame with width 516 would use 3 strides so pitch would be 768.