Android SDL_SetVideoMode crash when not called by main

Hi all
I am facing a strange issue i can’t solve nor understand
I use SDL1.3 on Android to display frames decoded by ffmpeg.
If the SDL renderer is directly created in the main(argc, argv) fonction, and then initialized, there is no trouble

Code:
05-31 09:24:11.442: V/SDL(11376): pixel format RGB_565
05-31 09:24:11.442: I/SDL(11376): SDL_Android_Init()
05-31 09:24:11.442: I/Main(11376): Entering main
05-31 09:24:13.817: I/SDLRenderer(11376): Entering SDLRenderer::init
05-31 09:24:13.817: I/SDLRenderer(11376): SDLRenderer::init -> About to create screen with w=704 h=480
05-31 09:24:13.817: I/SDL(11376): [STUB] GL_LoadLibrary
05-31 09:24:13.822: V/SDL(11376): Starting up OpenGL ES 2.0
05-31 09:24:13.827: D/libEGL(11376): loaded /system/lib/egl/libEGL_mali.so
05-31 09:24:13.832: D/libEGL(11376): loaded /system/lib/egl/libGLESv1_CM_mali.so
05-31 09:24:13.832: D/libEGL(11376): loaded /system/lib/egl/libGLESv2_mali.so
05-31 09:24:13.837: D/(11376): Device driver API match
05-31 09:24:13.837: D/(11376): Device driver API version: 10
05-31 09:24:13.837: D/(11376): User space API version: 10
05-31 09:24:13.837: D/(11376): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Fri May 4 10:32:42 KST 2012
05-31 09:24:13.862: I/SDL(11376): [STUB] GL_SetSwapInterval
05-31 09:24:13.862: I/SDL(11376): [STUB] GL_GetSwapInterval
05-31 09:24:13.932: I/SDLRenderer(11376): SDLRenderer::init -> screen created with w=704 h=480
05-31 09:24:13.932: I/SDLRenderer(11376): SDLRenderer::init -> About to create YUV Overlay with SDL_YV12_OVERLAY and w=704 h=480
05-31 09:24:13.932: I/SDLRenderer(11376): SDLRenderer::init -> YUV Overlay created with SDL_YV12_OVERLAY and w=704 h=480

BUT, if in the main function, I create a simple thread to do the previous job
(create a SDL renderer and initialize it) it crashes in SDL_SetVideoMode
Nothing else changed, the only change is the call of the renderer init in a thread rather than directly
in the main(argc, argv)…

Code:
05-31 10:33:04.462: V/SDL(23043): pixel format RGB_565
05-31 10:33:04.462: I/SDL(23043): SDL_Android_Init()
05-31 10:33:04.462: I/Main(23043): Entering main
05-31 10:33:05.882: I/Main(23043): Main: About to create thread DecodeVideo
05-31 10:33:05.882: I/Main(23043): Starting DecodeVideo
05-31 10:33:06.457: I/SDLRenderer(23043): Entering SDLRenderer::init
05-31 10:33:06.462: I/SDLRenderer(23043): SDLRenderer::init -> About to create screen with w=704 h=480
05-31 10:33:06.462: I/SDL(23043): [STUB] GL_LoadLibrary
05-31 10:33:06.462: A/libc(23043): Fatal signal 11 (SIGSEGV) at 0x00000364 (code=1)

Does anybody knows if there is something special to do to solve that ?
Thank you for any answer.
Zbb

Really? no idea??
Zbb

**
Really? no idea??
Zbb

SDL 1.3 is an ancient unstable version not more supported, where Android
target was in alpha state.

You should use SDL 2.0, but I fear your are using the old API
(SDL_SetVideoMode), that is no more supported by SDL 2.x.

Anyway you are trying to do something that is not compatible with SDL nor
opengl (at least not with a single context): rendering in a secondary
thread.

You can decode your video with ffmpeg in a secondary thread, but you have
to blit it to your surface/texture in the main thread.

I also remember that YV12 overlay handling with the 1.3 old api emulation
was dead slow.

I suggest you to move to SDL 2.0 and use a SDL_Texture with streaming
access as destination.On Tue, Jun 4, 2013 at 1:49 PM, zebeubeul wrote:


Bye,
Gabry