SDL2 app works correctly on Windows, but not in Linux

I have this code:
https://wiki.videolan.org/LibVLC_SampleCode_SDL/ (second snippet)
on Windows it’s working correctly (shows a video), but in Lubuntu 14.04 and Debian 8.x.x, I just getting empty window as in video: https://www.youtube.com/watch?v=uHfH19Fd2Bo

Any ideas where is problem?
Thank you

When I started with SDL2 I had exactly the same problem: my code worked in Windows but not in Linux. In my case it turned out to be because I had taken liberties with threading: I was calling SDL rendering functions from multiple threads. It should never have worked at all really, but Windows seemed to be more tolerant of my mistake.

I don’t know whether your problem stems from a similar cause, but I do notice that you are (for example) calling SDL_RenderPresent from a VLC callback, and that could well be being made from a different thread.

Richard.

Hello Richard,

I moved rendering into another thread, now it’s working, but only if I have in renderer SDL_RENDERER_SOFTWARE, else I have black screen. Any ideas?

Thanks

I don’t really know. If you un-comment the SDL_SetRenderDrawColor() statement do you get a green background, or is it still black? Do you have to use the BGR565 pixel format or can you try a different one?

Richard.

1 Like

The libvlc example uses the callback from libvlc to update the texture from a non-gui thread.
You need to use some kind of message between the threads.

https://pastebin.com/qxcwNstX